blob: cc8457124e884376ab6742520c88d68d412cd55f (
plain)
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
|
var httpServer = function () {
var http = require('http'),
url = require('url'),
fs = require('fs'),
start = function (port) {
var server = http.createServer(function (req, res) {
processHttpRequest(res);
});
server.listen(port, function () {
console.log('Listening on ' + port + '...');
});
},
processHttpRequest = function (res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
console.log('received message');
setTimeout(() => {
res.end('Published Successfully.\n');
}, 100);
};
return {
start: start
}
}();
httpServer.start(3904);
|