-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
30 lines (24 loc) · 908 Bytes
/
server.js
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
29
30
var http = require('http');
var url = require('url');
function start(route, handle){
function onRequest(request, response){
var postData = "";
var pathname = url.parse(request.url).pathname;
console.log('request received for : ' + pathname);
//request.setEncoding('utf8');
//
//request.addListener('data', function(postDataChunk){
// postData += postDataChunk;
// console.log('Received POST data chunk: ' + postDataChunk);
//});
//request.addListener('end', function(){
// console.log('Received POST data end.');
// route(handle, pathname, response, postData);
//});
//route(handle, pathname, response);
route(handle, pathname, response, request);
}
http.createServer(onRequest).listen(8888);
console.log("Server has started.");
}
exports.start = start;