Showing
1 changed file
with
7 additions
and
4 deletions
| ... | @@ -14,6 +14,7 @@ cert: cert, | ... | @@ -14,6 +14,7 @@ cert: cert, |
| 14 | ca: ca | 14 | ca: ca |
| 15 | }, app).listen(80,()=>{ | 15 | }, app).listen(80,()=>{ |
| 16 | console.log('server on 80'); | 16 | console.log('server on 80'); |
| 17 | + console.log(status) | ||
| 17 | }); | 18 | }); |
| 18 | 19 | ||
| 19 | https.createServer({ | 20 | https.createServer({ |
| ... | @@ -52,10 +53,12 @@ const client = new line.Client(config); | ... | @@ -52,10 +53,12 @@ const client = new line.Client(config); |
| 52 | 53 | ||
| 53 | // register a webhook handler with middleware | 54 | // register a webhook handler with middleware |
| 54 | // about the middleware, please refer to doc | 55 | // about the middleware, please refer to doc |
| 55 | -app.get('/',(req,res)=>{ | 56 | +app.post('/webhook', line.middleware(config), (req, res) => { |
| 56 | - res.send("hellow"); | 57 | + console.log("webhook"); |
| 57 | -}) | 58 | + Promise |
| 58 | - | 59 | + .all(req.body.events.map(handleEvent)) |
| 60 | + .then((result) => res.json(result)) | ||
| 61 | +}); | ||
| 59 | // event handler | 62 | // event handler |
| 60 | function handleEvent(event) { | 63 | function handleEvent(event) { |
| 61 | console.log("handleevent"); | 64 | console.log("handleevent"); | ... | ... |
-
Please register or login to post a comment