Advertisement
Guest User

Untitled

a guest
May 26th, 2016
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 'use strict';
  2.  
  3. var express = require('express');
  4. var app = express();
  5. var fs = require("fs");
  6.  
  7. app.get('/webhook', function (req, res) {
  8.    
  9.     console.log(req.query['hub.token']);
  10.    
  11.     if (req.query['hub.verify_token'] === 'candelabro') {
  12.         res.end(req.query['hub.challenge']);    
  13.     }
  14.    
  15.    
  16. });
  17.  
  18. app.post('/webhook', function (req, res) {
  19.     console.log(req);
  20.     res.end( 'post' );
  21. });
  22.  
  23. var server = app.listen(8080, function () {
  24.  
  25.   var host = server.address().address
  26.   var port = server.address().port
  27.  
  28.   console.log("app listening at http://%s:%s", host, port)
  29.  
  30. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement