Version : v1.0.0
- Type these command on your command prompt/terminal
node main.js
- After showing this
App Listening on port 5000
Go to your favourite browser then type localhost:5000
, then press ENTER
To stop the running server, use Ctrl + C
.
You can automate running the main.js
backend server side using nodemon
- Install nodemon globally
npm i nodemon
- After installation finished, when you want to run the backend server side, just type
nodemon main.js
- Then after showing this
[nodemon] 2.0.20
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): .
[nodemon] watching extensions: js,mjs,json
[nodemon] starting `node main.js`
App Listening on port 5000
Same as before you can type to your favourite browser localhost:5000
.
But the different is, you can edit main.js file anytime and everytime you save changes, nodemon will help to continue running the most updated line of code of that main.js file, so you don't need to Ctrl + C
to stop the server then retype node main.js
again.