I am using my express js app as webhook. There is a .get() method only for sending HTML page (Home Page) to browser.
app.get('/', (req, res) => {
//res.send('Hello World!');
res.sendFile(path.join(__dirname, '/views/abc.html'));
});
Now I have another method for handling webhook request as follow.
app.post('/',(req,res)=> {
const text = req.body.text;
const jsonResponse = {
"fulfillmentMessages": [
{
"text": {
"text": [
"Text response from webhook"
]
}
}
]
}
res.status(200).send(jsonResponse);
});
Everything works perfectly, but the above get() method sends response to the webhook which eventually ends up as an error.
I don't want to send this HTML as it is only my website home page. How do I restrict this method from sending response to webhook.