Hello people!
Hope you like my previous HOW TO tutorials. So in today's post, we will be making a custom server with Nodejs in 3 minutes.
What you need:
* Knowledge of javascript and Nodejs
* Npm installed
So without any further due, let us get to the main point.
If you have installed the npm package, then Go to the terminal!
//switch to the directory where you want to store your files
cd documents
//make a new folder to store the meta data of the server.
mkdir server
//switch to this "server" file and then start with npm
cd server
//create a package.json file with npm
npm init
//use this command to create a file named app.js
touch app.js
NOTE: we will code only in the app.js folder.
You should get this message(listening at port 3000) on the console if your server is working properly.
Congrats, you have your own custom server.
Give a ❤ if you liked the tutorial.
Top comments (2)
Hi Vikas and thanks for this article!
For people that are on the clock, you can even create a server in one terse line.
You can even fire a Node.js server in a terminal.
This is not very interesting for most applications, but this is a cool trick to know!
thanks for sharing.