Search code examples
javascriptnode.jsdialogflow-esfacebook-messengerngrok

ngrok Cannot GET / local server up and running


I'm trying to follow Crowdbotics' Messenger bot tutorial, however. I did exactly as he mentioned but i am getting this.

My folder:

enter image description here

Okay so, first of all i run node index.js and get the following:

enter image description here

Right after that. We initialize our ngrok server by ngrok http 5000 and get the following:

enter image description here

But on EVERY http request i get the classic Cannot GET /.

On the hindsight, my index.js only contain:

const express = require("express");
const bodyParser = require("body-parser");

const app = express();

app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));

app.listen(5000, () => console.log('Webhook server is listening, port 5000'));

I can't really point out what i am doing wrong, your help is truly appreciated.


Solution

  • Based on your express js code, I think you haven't define the routes to '/'

    add this before the app.listen on the index.js file

    app.get('/', (req, res) => res.send('Hello World!'))