added server for later
This commit is contained in:
parent
6c4daaed93
commit
e99e147466
1 changed files with 18 additions and 0 deletions
18
server.js
Normal file
18
server.js
Normal file
|
@ -0,0 +1,18 @@
|
|||
var app = require('http').createServer(handler),
|
||||
fs = require('fs');
|
||||
|
||||
app.listen(80);
|
||||
|
||||
|
||||
function handler (req, res) {
|
||||
fs.readFile(__dirname + req['url'],
|
||||
function (err, data) {
|
||||
if (err) {
|
||||
res.writeHead(500);
|
||||
return res.end('<h3>Error loading ' + __dirname + req['url'] + '</h3>');
|
||||
}
|
||||
|
||||
res.writeHead(200);
|
||||
res.end(data);
|
||||
});
|
||||
}
|
Loading…
Reference in a new issue