Advantages of Express

Express is a web application framework for Node.js, modeled after the Ruby project Sinatra.[66] Express provides a lot of the plumbing code that you’d otherwise end up writing yourself. To see why, let’s take a look at a basic Node.js server using only the http module.

​ ​'use strict'​;
​ ​const​ http = require(​'http'​);
​ ​const​ server = http.createServer((req, res) => {
​  res.writeHead(200, {​'Content-Type'​: ​'text/plain'​});
​  res.end(​'Hello World​​\​​n'​);
​ });
​ server.listen(60700, () => console.log(​'Ready!'​));

This is quite similar to creating a basic TCP server using the net module like you did way back in Chapter 3, ​Networking ...

Get Node.js 8 the Right Way now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.