arnaucube
arnaucube/thoughtsPublic Self-hosted repository
thoughts/node_modules/mongoose/static.js
node_modules/mongoose/static.jsRaw
 1
 2var static = require('node-static');
 3var server = new static.Server('.', {cache: 0});
 4
 5require('http').createServer(function(req, res) {
 6  if (req.url === '/favicon.ico') {
 7    req.destroy();
 8    res.statusCode = 204;
 9    return res.end();
10  }
11
12  req.on('end', function() {
13    server.serve(req, res, function(err) {
14      if (err) {
15        console.error(err, req.url);
16        res.writeHead(err.status, err.headers);
17        res.end();
18      }
19    });
20  });
21  req.resume();
22}).listen(8088);
23
24console.error('now listening on http://localhost:8088');