Express

5.2.1 · active · verified Sat Apr 18

Express is a fast, unopinionated, and minimalist web framework for Node.js. The current stable major versions are v5.2.1 and v4.22.1, with both branches actively maintained and receiving regular updates, including security patches and bug fixes. Version 5 offers improved security and drops support for older Node.js versions, while version 4 continues to provide stability for existing applications.

Common errors

Warnings

Install

Imports

Quickstart

This demonstrates a basic 'Hello World' Express server listening on port 3000 (or specified by PORT environment variable), responding to GET requests on the root path '/'.

import express, { Express, Request, Response } from 'express';

const app: Express = express();
const port = process.env.PORT ?? 3000;

app.get('/', (req: Request, res: Response) => {
  res.send('Hello from Express!');
});

app.listen(port, () => {
  console.log(`⚡️[server]: Server is running at http://localhost:${port}`);
});

view raw JSON →