-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
executable file
·28 lines (23 loc) · 813 Bytes
/
Copy pathserver.js
File metadata and controls
executable file
·28 lines (23 loc) · 813 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/**
* Created by wk on 5/30/16.
*/
var http = require("http");
var url = require("url");
function start(route, handle) {
function onRequest(request, response) {
var pathname = url.parse(request.url).pathname;
var temp = pathname.substring(0,pathname.length-1).substring(2);
var postData = temp;
var path = "/"
if(pathname!='/favicon.ico'){
var date = new Date();
console.log(date.toISOString()+": Request for " + pathname + " received.");
}
//console.log("Request for " + pathname + " received.");
route(handle, path, response, request, postData);
}
http.createServer(onRequest).listen(8888);
var date = new Date();
console.log(date.toISOString()+": Server has started.");
}
exports.start = start;