GT2/GT2-iOS/node_modules/logfmt/examples/vanilla_http.js

14 lines
337 B
JavaScript
Raw Normal View History

2018-02-12 17:26:06 +00:00
var http = require('http');
var logfmt = require('../logfmt');
var through = require('through');
http.createServer(function (req, res) {
req.pipe(logfmt.streamParser())
.pipe(through(function(object){
console.log(object);
}))
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('okay');
}).listen(3000);