An HTTP server is software that listens for HTTP requests and returns responses. A minimal Node.js service can expose a route, send text, and listen on a port. section 2.6.3 section 2.6.4
Build a minimal server incrementally:
- Create a Node.js project and install Express. section 2.6
- Create an entry point such as src/index.js and instantiate the Express application. section 2.6.3
- Register an HTTP GET route that sends a response. section 2.6.3
- Call listen with a port, then run the script with Node.js. section 2.6.3 section 2.6.4
- Open the local address in a browser and stop the process with Ctrl-C. section 2.6.4
Streaming video service
A first microservice can serve video through a GET /video route, allowing a browser to watch the stream at http://localhost:3000/video. section 2.6
Listing 2.3 A minimal Express web server
const express = require('express'); #1
const app = express(); #2
const port = 3000; #3
app.get('/', (req, res) => { #4
res.send('Hello World!'); #5
});
app.listen(port); #6
Use the minimal Express listing as a copyable baseline for defining a route, sending a response, and starting the server. section 2.6.3










