step: 1
now create sample project with specific folder node js type : npm init -y
step: 2
than install express js type: npm install express --save
step: 3
create index.js file add snippets code :
const express = require("express");
const app = express();
app.use(express.static(__dirname+'/root'));
app.listen(44859, '192.168.0.106' || 'localhost',function () {
console.log("server is running on port 44859");
});
use this url on browser : http://192.168.0.106:44859
step: 4
than you create root folder and add some html code index.html file
step: 5
install nodemon and run : nodemon index.js
now create sample project with specific folder node js type : npm init -y
step: 2
than install express js type: npm install express --save
step: 3
create index.js file add snippets code :
const express = require("express");
const app = express();
app.use(express.static(__dirname+'/root'));
app.listen(44859, '192.168.0.106' || 'localhost',function () {
console.log("server is running on port 44859");
});
use this url on browser : http://192.168.0.106:44859
step: 4
than you create root folder and add some html code index.html file
step: 5
install nodemon and run : nodemon index.js
0 Comments