自分用メモ
index.js
var http = require('http');
http.createServer(function(req, res) {
if(req.method === 'GET') {
// do something ;
} else if(req.method === 'POST') {
var data = '';
req.on('data', function(chunk) {data += chunk}).on('end', function() {
console.log(data);
// res.end(html);
})
}
}).listen(6666); // portの番号
これを適当なところに配置して、 $ node index.js
すればlistenし続ける。
ので、 localhost:6666
に向かって適当にpostすれば良い。(ngrokで6666を外に向けても良い)