You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
552 B

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