Yes, we can create Http Server in Nodejs. We can use http-server command to do so.
Code :
var http = require('http');
var requestListener = function (request, response) {
response.writeHead(200, {'Content-Type': 'text/plain'});
response.end('Hello You\n');
}
var server = http.createServer(requestListener);
server.listen(8080); // The port where you want to start with.
Code :
var http = require('http');
var requestListener = function (request, response) {
response.writeHead(200, {'Content-Type': 'text/plain'});
response.end('Hello You\n');
}
var server = http.createServer(requestListener);
server.listen(8080); // The port where you want to start with.