How to Debug a Node.JS RestService with JSON information from API.AI


Hi there,

I’m new to cloud9 and Node.js. I’ve created a bot in Api.Ai and i’m using Node.js in Heroku to manage the complex things the bot can’t manage.

I all works fine, but i cannot debbug the code in cloud9/node.js since it stops as a RestService and I cannot go any further.

Can anyone help me here?

Thank you in advance. Mi code starts as this:

‘use strict’;
const child_process = require(‘child_process’);
const express = require(‘express’);
const bodyParser = require(‘body-parser’);
const restService = express();
const fs = require(‘fs’);
console.log(restService);’/hook’, function (req, res) {

console.log('hook request');

try {
    console.log("Starting Index.js");
    var speech = 'empty speech';
    var fue = 'followupEvent22';
    if (req.body.result.action == "jumptoPedirTarifaAcceso") {
        fue = 'eventPedirTarifaAcceso';