Showing
2 changed files
with
0 additions
and
20 deletions
helloWorld.js
deleted
100644 → 0
1 | -var http = require('http'); | ||
2 | - | ||
3 | -http.createServer(function (req, res) { | ||
4 | - var path = req.url.replace(/\/?(?:\?.*)?$/, '').toLowerCase(); | ||
5 | - switch (path) { | ||
6 | - case '': | ||
7 | - res.writeHead(200, { 'Content-Type': 'text/plain' }); | ||
8 | - res.end('Homepage'); | ||
9 | - break; | ||
10 | - case '/about': | ||
11 | - res.writeHead(200, { 'Content-Type': 'text/plain' }); | ||
12 | - res.end('About'); | ||
13 | - default: | ||
14 | - res.writeHead(404, { 'Content-Type': 'text/plain' }); | ||
15 | - res.end('Not Found'); | ||
16 | - break; | ||
17 | - } | ||
18 | -}).listen(3000); | ||
19 | - | ||
20 | -console.log('Server started on localhost:3000; press Ctrl-C to terminate....'); | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
test.txt
deleted
100644 → 0
File mode changed
-
Please register or login to post a comment