forked from Automattic/mongoose
-
Notifications
You must be signed in to change notification settings - Fork 0
/
static.js
26 lines (22 loc) · 613 Bytes
/
static.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
var static = require('node-static');
var server = new static.Server('.', { cache: 0 });
var open = require('open')
require('http').createServer(function (req, res) {
if ('/favicon.ico' == req.url) {
req.destroy();
res.statusCode = 204
return res.end();
}
req.on('end', function () {
server.serve(req, res, function (err) {
if (err) {
console.error(err, req.url);
res.writeHead(err.status, err.headers);
res.end();
}
});
});
req.resume();
}).listen(8088);
console.error('now listening on http:https://localhost:8088');
open('http:https://localhost:8088');