https://github.com/Automattic/mongoose
Raw File
Tip revision: 374c11798440c41222d0baf5ea1a0d76240e5c20 authored by Valeri Karpov on 11 June 2018, 20:50:59 UTC
chore: release 5.1.5
Tip revision: 374c117
static.js
const static = require('node-static');
const server = new static.Server('.', {cache: 0});

require('http').createServer(function(req, res) {
  if (req.url === '/favicon.ico') {
    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://localhost:8088');
back to top