fix 'res not defined'

This commit is contained in:
GotPPay
2018-01-18 21:43:25 +01:00
parent 68287d49ff
commit 48badce0f0

View File

@@ -2,8 +2,12 @@ var Alexa = require ('alexa-sdk');
const config = require ('../config/config'); const config = require ('../config/config');
var databaseHelper = require ('../helpers/database'); var databaseHelper = require ('../helpers/database');
// Build the context manually, because Amazon Lambda is missing var handlers = {};
var context = {
module.exports = {
run: function (req, res) {
// Build the context manually, because Amazon Lambda is missing
var context = {
succeed: function (result) { succeed: function (result) {
console.log (result); console.log (result);
res.json (result); res.json (result);
@@ -12,12 +16,8 @@ var context = {
console.log (error); console.log (error);
//We could send error json from here //We could send error json from here
}, },
}; };
var handlers = {};
module.exports = {
run: function (req, res) {
var alexa = Alexa.handler (req.body, context); var alexa = Alexa.handler (req.body, context);
alexa.appId = config.SKILL_ID; alexa.appId = config.SKILL_ID;
alexa.registerHandlers (handlers); alexa.registerHandlers (handlers);