how to create node js page with html

///////////////command line install for express//////////////

////////////express.js//////////////

const express=require('express');

 npm install express 


const app=express('');
app.get('',(req,res)=>{

res.send('Hello,this is home page');
});
app.get('/about',(req,res)=>{

res.send('hello this is about page');
});
app.listen(5000);
run with command
PS C:\Users\dell\desktop\node-tut> node .\express.js

run in web
http://localhost:5000/about




var http = require('http'),
    fs = require('fs');


fs.readFile('./index.html', function (err, html) {
    if (err) {
        throw err;
    }      
    http.createServer(function(request, response) {  
        response.writeHeader(200, {"Content-Type": "text/html"});  
        response.write(html);  
        response.end();  
    }).listen(8000);
});

Comments

Popular posts from this blog

How To Create a dynamic form in mysql php . How to create php dynamic form by admin in php

how manage leads mangement system user and manager auto assign in php how manage leads mangement system user and manager auto assign in php how manage leads mangement system user and manager auto assign in php

How to Run a Flask framework in Python How to Run a Flask framework in Python How to Run a Flask framework in Python How to Run a Flask framework in Python How to Run a Flask framework in Python How to Run a Flask framework in Python How to Run a Flask framework in Python