How to use HTML in NODE JS || Display simple HTML
-
Neel Bhardwaj
-
15-Jan-2022
-
0 comments
-
164
In this example i show to how to use only simple html code in NODE JS.
in this example the important thing is to use the
content-type:text/html
If u display the HTML.
EG:
var http = require('http');
const server = http.createServer((request,response)=>{
var data = "<html>
<html>
<head>
<title></title>
</head>
<body>
<input type="text">
</body>
</html>";
response.writeHead(200,{'content-type':'text/html'});
response.write(data);
response.end();
});
server.listen(3000,()=> console.log("Server run"));
"Programming isn't about what you know,
it's about what you can figure out.”
Leave a reply
Thanks for comment. Your comment are shown after approve by ADMIN. THANKS!!
There is some server issue. Please try again. THANKS!!
Fatal error: Cannot declare class Connection, because the name is already in use in /home/d8ouyzxnuef4/public_html/thecoderjob.com/cj_admin/classes/Connection.php on line 3
Recent comments