How do you create a basic Express server?

Express basics and middleware · Freshers

Model answer

import express from 'express'; const app = express(); app.get('/', (req, res) => res.send('Hello')); app.listen(3000). The app object defines routes by HTTP method and path, and listen starts the server on a port.

Learn this topic

Express Middleware Explained: next(), Logging and express.json() in the course Node.js and Express: Build a Back End API from Scratch.

Sign in to add your own answer.

More questions