Heo

html rendering test

Showing 1 changed file with 19 additions and 0 deletions
var http = require('http');
var fs = require('fs');
function onRequest(req, res){
res.writeHead(200, {'Content-Type': 'text/html'});
fs.readFile('./map/map.html', null, function(err,data){
if(err){
res.writeHead(404);
res.write('error');
}
else{
console.log('complete!');
res.write(data);
}
res.end();
});
}
http.createServer(onRequest).listen(3000);
\ No newline at end of file