Skip to content

Instantly share code, notes, and snippets.

@SREENATHPGS
Created August 19, 2019 19:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SREENATHPGS/d87745a4dc6b3160620360f8210bd573 to your computer and use it in GitHub Desktop.
Save SREENATHPGS/d87745a4dc6b3160620360f8210bd573 to your computer and use it in GitHub Desktop.
Front end http server for serving static files for chat service.
var http = require('http');
var fs = require('fs');
var server = http.createServer( function (request, response) {
response.writeHead(200, {
'Content-Type':'text/html',
});
fs.readFile('./templates/client.html', null, function(error, data) {
if (error){
response.writeHead(404);
} else {
response.write(data);
}
response.end()
});
});
server.listen(5051, function () {
console.log((new Date()) + ' Server is listening on port 5051');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment