Home › Node.js Tutorial › Node.js Express basics
Node.js Express basics
A popular web framework.
Express makes servers shorter: install it with npm install express, then define routes with app.get. This example imitates routing in plain JavaScript.
Example code
const routes = { "/": "Home", "/about": "About" };
function get(p) { return routes[p] || "Not found"; }
console.log(get("/about"));
console.log(get("/x"));