From 48badce0f085e59799315c2944fe1d70a4add687 Mon Sep 17 00:00:00 2001 From: GotPPay Date: Thu, 18 Jan 2018 21:43:25 +0100 Subject: [PATCH] fix 'res not defined' --- backend/models/alexa.js | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/backend/models/alexa.js b/backend/models/alexa.js index a4b0471..ebfce94 100644 --- a/backend/models/alexa.js +++ b/backend/models/alexa.js @@ -2,22 +2,22 @@ var Alexa = require ('alexa-sdk'); const config = require ('../config/config'); var databaseHelper = require ('../helpers/database'); -// Build the context manually, because Amazon Lambda is missing -var context = { - succeed: function (result) { - console.log (result); - res.json (result); - }, - fail: function (error) { - console.log (error); - //We could send error json from here - }, -}; - var handlers = {}; module.exports = { run: function (req, res) { + // Build the context manually, because Amazon Lambda is missing + var context = { + succeed: function (result) { + console.log (result); + res.json (result); + }, + fail: function (error) { + console.log (error); + //We could send error json from here + }, + }; + var alexa = Alexa.handler (req.body, context); alexa.appId = config.SKILL_ID; alexa.registerHandlers (handlers);