In the last tutorial we showed how to create requests based on the URL: Node.js tutorial: Requesitions based on URL.
In this tutorial we gona use Express.js to make the same operations in a easier away.
Express.js is a framework for Node.js that allows us develop web applications in a easier away.
How to instal Express.js?
First we open Node.js command prompt and change the directory for the one we are working on, then type the following command:
npm install express -save
After the instalation the command prompt should look like this:
Now considering the last tutorial the notepad++ file should contain the following code:
After we create the file above we name it as “index.js” then on the Node.js command prompt we execute the following command:
The next step is open a browser and type the URL address to obtain its content.
To access the laptops category :
To access the smartphones category :
To accessthe smartphones tablets: