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.

20 lines
507 B

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