How to run Node.js program?
node command is used to run Node.js program.
Below command is used to execute file.
D:\nodejs\website> node server.js
It runs server.js file.
D:\nodejs\website> nodemon
This command runs application. If you use nodemon command for your application, then you don't need to run application everytime after changing code.
Example (file server.js):
const express = require('express');
const app = express();
const port =6666;
app.listen(port, () => {
console.log(`Server running on port: ${port}`);
});
//Output : Server running on port: 6666
Comments