-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathn10_param.js
More file actions
21 lines (20 loc) · 762 Bytes
/
n10_param.js
File metadata and controls
21 lines (20 loc) · 762 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
var http = require('http');
var url = require('url');
var route = require('./module/router')
http.createServer(function (resquest, response) {
if (resquest.url !== '/favicon.ico') {
var pathname = url.parse(resquest.url).pathname;
// port = url.parse(resquest.url).port
pathname = pathname.replace(/\//, '');
try {
route[pathname](resquest,response);
} catch (error) {
console.log('--'+error+'--');
response.writeHead(200, { 'Content-Type': 'text/html;charset=uft-8' });
response.write(error.toString());
response.end();
}
console.log('主程序执行完毕')
}
}).listen(8899);
console.log(`sever start at http://localhost:8080`);