Now that we have built a router of our own and understand the basics of Node.js, it is time to get introduced to one of the most widely-used frameworks for Node.js, Express (http://expressjs.com). Node.js provides the infrastructural components to build a web application, but there is too much stuff to handle. Therein lies the role of the web frameworks. There are quite a few web frameworks that provide a higher level of abstraction for building applications on Node. You can see a list of most of them here:
https://github.com/joyent/node/wiki/Modules#wiki-web-frameworks-full
Express is a web application framework for Node, built over the Connect middleware, that provides many more helpers and structural aspects to build our web applications.
To get started with the Express framework, we need to install it using npm, the Node.js package manager.
sudo npm install -g express
The previous command will install Express as a global (-g
) module and make express...