- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreateServer.js
More file actions
Latest commit
14 lines (10 loc) · 576 Bytes
/
Copy pathcreateServer.js
File metadata and controls
14 lines (10 loc) · 576 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
varhttp=require('http');
varmyModule=require('./module');
varurl=require('url');
http.createServer(function(req,res){// "req" argument represents the requests from the clients. It aslo contains the url which can be get by "req.url"
res.writeHead(200);// 200 is status code
varq=url.parse(req.url,true).query;// Split query string into readable parts.
vartxt=q.year+" "+q.month;
res.write('Date & Time:'+myModule.moduleName()+","+req.urls+","+txt);// calling function created in module.
res.end();
}).listen(8080);