Skip to content

Instantly share code, notes, and snippets.

@eleda
Created November 29, 2016 18:56
Show Gist options
  • Save eleda/d7afff4c3b2004d8dc36c35caa7bf734 to your computer and use it in GitHub Desktop.
Save eleda/d7afff4c3b2004d8dc36c35caa7bf734 to your computer and use it in GitHub Desktop.
/**
* Created by dávid on 2016.11.29..
*/
var http = require('http');
var fs = require('fs');
function onRequest (request, response) {
response.writeHead(200, {'Content-Type': 'text/html'});
fs.readFile('./index.html', null, function (error, data) {
if (error) {
response.writeHead(404);
response.write('File Not Found');
} else {
response.write(data);
}
response.end();
});
}
http.createServer(onRequest).listen(3000);
@eleda
Copy link
Author

eleda commented Nov 29, 2016

Ez egy HTML oldalt betöltő kis szerver.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment