Showing
1 changed file
with
19 additions
and
0 deletions
app2.js
0 → 100644
1 | +var http = require('http'); | ||
2 | +var fs = require('fs'); | ||
3 | + | ||
4 | +function onRequest(req, res){ | ||
5 | + res.writeHead(200, {'Content-Type': 'text/html'}); | ||
6 | + fs.readFile('./map/map.html', null, function(err,data){ | ||
7 | + if(err){ | ||
8 | + res.writeHead(404); | ||
9 | + res.write('error'); | ||
10 | + } | ||
11 | + else{ | ||
12 | + console.log('complete!'); | ||
13 | + res.write(data); | ||
14 | + } | ||
15 | + res.end(); | ||
16 | + }); | ||
17 | +} | ||
18 | + | ||
19 | +http.createServer(onRequest).listen(3000); | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
-
Please register or login to post a comment