LoginSignup
0
0

More than 3 years have passed since last update.

postを受け取るだけのサーバーを立てる

Posted at

自分用メモ

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を外に向けても良い)

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0