app.post('/api/switches/:id', function(req, res){ if (req.query.password === process.env.PASS){ var foundSwitch = getSwitch(req.params.id); if(!(req.query.command === "on" || req.query.command === "off")){ foundSwitch.toggle(); } else { foundSwitch.setState(req.query.command) } saveState(); console.log("postSwitch "+JSON.stringify(foundSwitch)); res.json(foundSwitch); } else { console.log("invalid password") res.send("try again") }})app.post('/', function (request, response) { console.log('headers: ' + JSON.stringify(request.headers)); console.log('body: ' + JSON.stringify(request.body)); const assistant = new Assistant({request: request, response: response});
function generateAnswer(assistant) { assistant.data.answer = 33; assistant.ask('I\'m thinking of a number from 0 and 100. What\'s your first guess?'); } function checkGuess(assistant) { console.log('checkGuess'); } let actionMap = new Map(); actionMap.set(GENERATE_ANSWER_ACTION, generateAnswer); actionMap.set(CHECK_GUESS_ACTION, checkGuess); assistant.handleRequest(actionMap);});2017-04-30T15:12:25.722224+00:00 app[web.1]: npm ERR! node app.js2017-04-30T15:12:25.722325+00:00 app[web.1]: npm ERR! You can get information on how to open an issue for this project with:2017-04-30T15:12:25.722425+00:00 app[web.1]: npm ERR! npm bugs number-genie2017-04-30T15:12:25.722627+00:00 app[web.1]: npm ERR! Or if that isn't available, you can get their info via:2017-04-30T15:12:25.722711+00:00 app[web.1]: npm ERR! npm owner ls number-genie2017-04-30T15:12:25.722798+00:00 app[web.1]: npm ERR! There is likely additional logging output above.2017-04-30T15:12:25.725968+00:00 app[web.1]:2017-04-30T15:12:25.726116+00:00 app[web.1]: npm ERR! Please include the following file with any support request:2017-04-30T15:12:25.726177+00:00 app[web.1]: npm ERR! /app/npm-debug.log2017-04-30T15:12:25.824126+00:00 heroku[web.1]: State changed from starting to crashed2017-04-30T15:12:25.811765+00:00 heroku[web.1]: Process exited with status 1