Skip to content

Instantly share code, notes, and snippets.

@nuhil
Created April 7, 2020 00:19
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 nuhil/b2850089a1b1d6436651a9d830a44d0c to your computer and use it in GitHub Desktop.
Save nuhil/b2850089a1b1d6436651a9d830a44d0c to your computer and use it in GitHub Desktop.
var http = require('http'),
fs = require('fs');
var server = http.createServer().listen(3000);
server.on('request', function (request, response) {
fs.readFile('file.txt', 'utf-8', function (err, data) {
response.end(data);
});
});
console.log("Listening on port 3000...");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment