Revision 08d9ab37543b09a3032a8fb4350592325032210f authored by Valeri Karpov on 17 August 2014, 22:25:49 UTC, committed by Valeri Karpov on 17 August 2014, 22:25:49 UTC
1 parent 6657f2d
Raw File
static.js

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://localhost:8088');
open('http://localhost:8088');
back to top