title: curl-Command returning html instead of node.js
body: <p>I'm trying to create and host a webhook via heroku, using this Facebook-messenger-tutorial: <a href="https://developers.facebook.com/docs/messenger-platform/getting-started/webhook-setup" rel="nofollow noreferrer">https://developers.facebook.com/docs/messenger-platform/getting-started/webhook-setup</a>.
  Therefore, I'm currently testing cURL-requests to my local host. This request: </p>
  
  <pre><code>curl -H "Content-Type: application/json" -X POST "localhost:3000/" -d "{""object"": ""page"", ""entry"": [{""messaging"": [{""message"": ""TEST_MESSAGE""}]}]}"
  </code></pre>
  
  <p>should return EVENT RECEIVED in the cmd, and TEST_MESSAGE in a second cmd-window, where I'm executing my application. 
  For executing the application, I used $ node index.js, and I'm receiving "webhook listening" which means to me there is no mistake in the way I execute it. </p>
  
  <p>This is how my file index.js looks like:</p>
  
  <pre><code>'use strict';
  
  // Imports dependencies and set up http server
  const
    express = require('express'),
    bodyParser = require('body-parser'),
    app = express().use(bodyParser.json()); // creates express http server
  
  // Sets server port and logs message on success
  app.listen(process.env.PORT || 3000, () =&gt; console.log('webhook is listening'));
  // Creates the endpoint for our webhook 
  app.post('/webhook', (req, res) =&gt; {  
  
    let body = req.body;
  
    // Checks this is an event from a page subscription
    if (body.object === 'page') {
  
      // Iterates over each entry - there may be multiple if batched
      body.entry.forEach(function(entry) {
  
        // Gets the message. entry.messaging is an array, but 
        // will only ever contain one message, so we get index 0
        let webhook_event = entry.messaging[0];
        console.log(webhook_event);
      });
  
      // Returns a '200 OK' response to all requests
      res.status(200).send('EVENT_RECEIVED');
    } else {
      // Returns a '404 Not Found' if event is not from a page subscription
      res.sendStatus(404);
    }
  
  });
  // Adds support for GET requests to our webhook
  app.get('/webhook', (req, res) =&gt; {
  
    // Your verify token. Should be a random string.
    let VERIFY_TOKEN = "somepassword"
  
    // Parse the query params
    let mode = req.query['hub.mode'];
    let token = req.query['hub.verify_token'];
    let challenge = req.query['hub.challenge'];
  
    // Checks if a token and mode is in the query string of the request
    if (mode &amp;&amp; token) {
  
      // Checks the mode and token sent is correct
      if (mode === 'subscribe' &amp;&amp; token === VERIFY_TOKEN) {
  
        // Responds with the challenge token from the request
        console.log('WEBHOOK_VERIFIED');
        res.status(200).send(challenge);
  
      } else {
        // Responds with '403 Forbidden' if verify tokens do not match
        res.sendStatus(403);      
      }
    }
  });
  </code></pre>
  
  <p>And this is the respond I'm getting (some html-code):</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
  &lt;head&gt;
  &lt;meta charset="utf-8"&gt;
  &lt;title&gt;Error&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;pre&gt;Cannot POST /&lt;/pre&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><strong>I do not receive an error, just the "wrong" return.</strong></p>
  
  <p>Does anyone have an idea on how to fix this and receive "EVENT RECEIVED" and "TEST_MESSAGE"?</p>
  
  <p>Note: I have seen the follwoing articles, <a href="https://stackoverflow.com/questions/40802439/curl-command-no-return">Curl command no return</a>, <a href="https://stackoverflow.com/questions/53005111/prometheus-api-returning-html-instead-of-json">Prometheus API returning HTML instead of JSON</a> and I did change something of the code from the tutorial relating to <a href="https://stackoverflow.com/questions/51754510/facebook-messenger-bot-error-unexpected-token-in-json-at-position-0">Facebook messenger bot error Unexpected token &#39; in JSON at position 0</a>, but I am still not able to fix this. </p>
  
  <p>I also read <a href="https://stackoverflow.com/questions/7172784/how-do-i-post-json-data-with-curl-from-a-terminal-commandline-to-test-spring-res">How do I POST JSON data with Curl from a terminal/commandline to Test Spring REST?</a>, but it didn't solve my problem, too.</p>