summaryrefslogtreecommitdiffstats
path: root/common/src/main/webapp/usageguide/appserver/node_modules/mongoose/static.js
blob: d84e59f7a3aa5793cb2e8a2fbe320610dc51faaf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
var static = require('node-static');
var 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');