Node.js & Express
JavaScript on the server
Run JavaScript on the server. Build fast APIs and backends with Node.js and the Express framework β the foundation of most JS backends.
Node.js & Express Setup
Install Node.js and stand up your first Express server.
Install Node.js
# Download the LTS build from https://nodejs.orgWhat it does
Node.js runs JavaScript outside the browser and ships with npm to install packages.
Why you need it
Express and every npm package run on Node β nothing works without it.
Alternatives: Use nvm/fnm to manage multiple Node versions per project.
Create a project
mkdir my-api && cd my-api
npm init -yWhat it does
`npm init -y` creates a package.json that tracks your dependencies and scripts.
Why you need it
It's the manifest npm uses to install and run everything in your project.
Install Express
npm install expressWhat it does
Express is a minimal web framework for routing and handling HTTP requests.
Why you need it
It saves you from writing raw `http` server boilerplate for every route.
Alternatives: Fastify, Hono, Koa, or the built-in `node:http` module.
Run your server
node index.jsWhat it does
Start your server file. Add a `dev` script with nodemon for auto-restart on changes.
Why you need it
You need the server running to handle requests while you build.