forked from sp013719/Nodejs_tutorial
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
Latest commit
23 lines (18 loc) · 732 Bytes
/
Copy pathserver.js
File metadata and controls
23 lines (18 loc) · 732 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
varhttp=require("http");
varurl=require("url");
varstart=function(route,handler){
varonRequest=function(request,response){
varpathname=url.parse(request.url).pathname;
varqueryString=url.parse(request.url).query;
console.log("request is received, url is "+pathname);
// response.writeHead(200, {"Content-type": "text/plain"});
// response.write(route(handler, pathname));
// response.end();
route(handler,pathname,response);
console.log("request processing is done, url is "+pathname
+", queryString is "+queryString);
};
http.createServer(onRequest).listen(8080);
console.log("server is started");
};
exports.start=start;