-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpost_server.js
More file actions
28 lines (28 loc) · 823 Bytes
/
post_server.js
File metadata and controls
28 lines (28 loc) · 823 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 JetBrains WebStorm.
* User: mru
* Date: 02/01/12
* Time: 11:31
* To change this template use File | Settings | File Templates.
*/
var http = require('http');
var sys = require('util');
http.createServer(
function (req, res) {
"use strict";
req.setEncoding('utf8');
console.log('REQUEST ARRIVE');
console.log(sys.inspect(req.headers));
var chunk = '';
req.on('data', function (data) {
chunk += data;
console.log('retrieved data');
console.log(data);
console.log("SIZE OF DATA at data EVENT:" + data.length);
});
req.on('end', function () {
console.log("RETRIEVED POSTDATA:\n" + chunk);
res.writeHead(200);
res.end();
});
}).listen(8001);