# 웹훅 튜토리얼

## 튜토리얼

Node.js에 내장된 http 모듈의 createServer 함수를 사용한 Webhook 수신 예제코드입니다.

```javascript
var http = require('http');


http.createServer(function(req, res) {


    var jsonData = "";


    req.on('data', function(chunk) {
        jsonData += chunk;
    });


    req.on('end', function(){


        // JSON Parse
        var reqObj = JSON.parse(jsonData);
        console.log(reqObj);
        console.log(reqObj['eventDT']);
        console.log(reqObj['eventType']);


        // Response 성공 처리.
        res.writeHead(200);
        res.end('{"result":"OK"}');
    });
}).listen(80);
```
