﻿"use strict"

//imports
var restify = require("restify")
var request = require("request");

//user modules
var webhookGet = require('./src/webhook_get.js');
var webhookPost = require('./src/webhook_post.js');
var apiai_webhook = require('./src/api-ai-webhook.js');

var server = restify.createServer();
server.use(restify.queryParser());
server.use(restify.bodyParser());

//root endpoint
server.get('/', function (req, res, next) {
	res.send('Nothing to see here...');
});

//facebook validation endpont
server.get("/webhook/", webhookGet);

//facebook message endpoint
server.post("/webhook/", webhookPost);

//api.ai generic storage hook
server.post("/apiaidb/", apiai_webhook);

var port = process.env.PORT || 1337;
server.listen(port, function () {
	console.log("listening on port:%s %s %s", port, server.name, server.url);
});


@@ -18,19 +18,21 @@
 imports%0A
-var
+const
  restify
@@ -53,19 +53,21 @@
 stify%22)%0A
-var
+const
  request
@@ -105,19 +105,21 @@
 modules%0A
-var
+const
  webhook
@@ -157,19 +157,21 @@
 t.js');%0A
-var
+const
  webhook
@@ -211,19 +211,21 @@
 t.js');%0A
-var
+const
  apiai_w
@@ -270,19 +270,21 @@
 .js');%0A%0A
-var
+const
  server 
@@ -410,25 +410,16 @@
 get('/',
- function
  (req, r
@@ -427,16 +427,19 @@
 s, next)
+ =%3E
  %7B%0A%09res.
@@ -687,11 +687,13 @@
 );%0A%0A
-var
+const
  por
@@ -746,23 +746,20 @@
 rt, 
-function () %7B%0A%09
+() =%3E %7B%0A    
 cons

refactor server.js to ES6