Created
August 19, 2019 19:14
-
-
Save SREENATHPGS/d87745a4dc6b3160620360f8210bd573 to your computer and use it in GitHub Desktop.
Front end http server for serving static files for chat service.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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