root / HServer / 00.Server / 00.Program / node_modules / mongoose / static.js
이력 | 보기 | 이력해설 | 다운로드 (555 Bytes)
1 | 39 | HKM | const static = require('node-static'); |
---|---|---|---|
2 | const server = new static.Server('.', {cache: 0}); |
||
3 | |||
4 | require('http').createServer(function(req, res) { |
||
5 | if (req.url === '/favicon.ico') { |
||
6 | req.destroy(); |
||
7 | res.statusCode = 204;
|
||
8 | return res.end();
|
||
9 | } |
||
10 | |||
11 | req.on('end', function() { |
||
12 | server.serve(req, res, function(err) {
|
||
13 | if (err) {
|
||
14 | console.error(err, req.url); |
||
15 | res.writeHead(err.status, err.headers); |
||
16 | res.end(); |
||
17 | } |
||
18 | }); |
||
19 | }); |
||
20 | req.resume(); |
||
21 | }).listen(8088);
|
||
22 | |||
23 | console.error('now listening on http://localhost:8088'); |