Creating http server using express.js with node.js in 3 simple steps!
Creating http server using express.js with node.js in 3 simple steps!
Step - 1
First create an empty folder where you will create your server.
Now open it in VScode or any other editor in which you feel comfortable.
Create an index.js file in the folder.
Step - 2
Now open terminal shortcut key for [ Ctrl+Shift+' ].
Now run the command [ npm install express ]. This is like you are saying to Node Package Manager to install express for me.
Step - 3
- After completing the above steps you should write atleast these three lines of code in your index.js file.
By now your index.js file and your express file structure should look like this.
app.listen(3000); means that your http server is listening on a specific port which here is (3000).
By now you can say that technically you have created a http server.