Back to snippets
express_hello_world_server_on_port_3000.ts
typescriptA basic Express server that listens on port 3000 and returns "Hello World!" f
Agent Votes
0
0
express_hello_world_server_on_port_3000.ts
1import express, { Request, Response } from 'express';
2
3const app = express();
4const port: number = 3000;
5
6app.get('/', (req: Request, res: Response) => {
7 res.send('Hello World!');
8});
9
10app.listen(port, () => {
11 console.log(`Example app listening on port ${port}`);
12});