Express
Express app.get()
Express matches requests to route handlers and middleware registered on an application. A handler can finish the response or pass control onward. Method and path select a route; query parameters are separate from the path. Register shared middleware before the routes it should affect. A parameter such as :id captures text, not a validated number. Router mounting adds a path prefix. Express 5 changed wildcard and optional path syntax; review migration guidance instead of copying Express 4 patterns. Static example only; runtime NOT RUN. Source: https://expressjs.com/en/guide/routing/.
Formal Syntax & Structure
nodejs syntaxnodejs
app.get(path, ...handlers)Working Example
Example Snippetnodejs
import express from 'express';const app = express();app.use('/catalog', (req, res, next) => { res.set('X-Catalog', 'demo'); next();});app.get('/catalog/:id', (req, res) => { if (req.params.id !== 'p1') return res.sendStatus(404); res.json({ id: 'p1', title: 'Notebook' });});export default app;