Express introduction
In this section of the chapter, we will set up a Node and Express development environment, and show how to build the simplest web server with just a few lines of code. We will then discuss routes, and show how to split up our code base into modules for ease of maintenance and readability. Finally, we will discuss how to set configuration parameters for a Node application.
Express setup
In order to build a Node and Express application, we just need to initialize a Node environment, and install a few npm packages, as well as their corresponding declaration files as follows:
mkdir node-express-app
cd node-express-app
npm init
npm install express
npm install @types/express --save-dev
Here, we have created a directory named node-express-app
, changed into this directory, and then initialized a Node environment. We then install the express
module using npm
, and install the TypeScript declaration files for Express, as in @types/express
. We will also need...