Tutorial 2: Express Module –
A middleware or Something more
Tutorial 1: NodeJS: An Asynchronous World
Tutorial 2: Express: Middleware or more...
Tutorial 3: Understanding Routing in Express
Tutorial 4: Develop a Static File Server
Tutorial 5: Using HTTPS with Express
Tutorial 6: Develop a JSON API server
Tutorial 7: Use Templates and Views with Express
Tutorial 8: Integrating MongoDB
Tutorial 9: Testing Express Applications
Tutorial 10: Securing Express
1. Provides a better routing mechanism
3. Helps in dividing your application into sub-applications or different modules.
Installing Express in your project
Before we learn about router and middle-ware concept, let us learn about what's the most practical approach installing Express and managing your project. It is recommended to create a package.json file which lists the local dependencies of your project. Somewhat it is analogous to your C++ or java makefile. To create a default package.json file, type the following command in your bash/command shell.
$ npm init –yes
It creates a default package.json file in the directory somewhat similar to shown below. It lists the dependencies e.g. We installed colors node module of version 1.1.2 In addition, there are other fields like description, keywords, authors related to your project.
To install Express we shall use the following command: