July 2018
Intermediate to advanced
404 pages
9h 5m
English
For Alexa, you created an Alexa router by declaring app.use("/alexa", alexaRouter). Similarly, you will be creating a Dialogflow router to handle Dialogflow requests, app.use("/dialogflow", dialogflowRouter), and then the body parser will be applied to the router to convert incoming HTTP requests to JSON objects. Finally, an HTTP server will be created using the routers for Alexa and Dialogflow.
The following code sets up Alexa and Dialogflow routers to handle incoming Dialogflow requests:
var verifier = require('alexa-verifier-middleware');var alexaRouter = express.Router();app.use("/alexa", alexaRouter);if (!process.env.ISDEBUG) { logger.info("Setup Alexa verifier."); alexaRouter.use(verifier);}alexaRouter.use(bodyParser.json()); ...Read now
Unlock full access