Remove serve, it's no longer needed.
Browse files
serve.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
| 1 |
-
const http = require('http'), fs = require('fs'), path = require('path');
|
| 2 |
-
|
| 3 |
-
http.createServer((req, res) => {
|
| 4 |
-
const file = '.' + (req.url === '/' ? '/index.html' : req.url);
|
| 5 |
-
|
| 6 |
-
fs.readFile(file, (err, data) => {
|
| 7 |
-
if (err) {
|
| 8 |
-
res.writeHead(404);
|
| 9 |
-
return res.end(String(err));
|
| 10 |
-
}
|
| 11 |
-
|
| 12 |
-
const ext = path.extname(file);
|
| 13 |
-
const contentType = {
|
| 14 |
-
'.html': 'text/html',
|
| 15 |
-
'.js': 'text/javascript',
|
| 16 |
-
'.css': 'text/css'
|
| 17 |
-
}[ext] || 'text/plain';
|
| 18 |
-
|
| 19 |
-
res.writeHead(200, { 'Content-Type': contentType });
|
| 20 |
-
res.end(data);
|
| 21 |
-
});
|
| 22 |
-
}).listen(8000, () => console.log('Serving on port 8000'));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|