Express is a free, open-source, minimal web framework for Node.js maintained by the OpenJS Foundation. It's the most common way to build an HTTP API in Node, reported in roughly 19.9% of developer surveys as the #5 most-used web technology. It stays deliberately unopinionated and lightweight โ just routing, middleware, and request/response helpers โ which is why so many other Node.js frameworks are built directly on top of it.
A working Express server with a JSON route takes just a few lines.
const express = require('express');
const app = express();
app.get('/api/users/:id', (req, res) => {
res.json({ id: req.params.id, name: 'Ava Chen' });
});
app.listen(3000, () => {
console.log('API running on port 3000');
});
Install Express as an npm dependency in any Node project โ no separate CLI or scaffold is required.
# create a project and add express
npm init -y
npm install express
# run your server
node index.js