I have an app that send POST
request and wait for certain amount of time until it gets message back from telegram bot API, I'm using Telegraf library to interact with telegram bot API. it works fine on the first request but i get Cannot set headers after they are sent to the client
error without even sending anything back to the server for second time. here's what the code looks like...
const router = require("express").Router();
const bot = require("./config/bot");
router.post("/", (req, res) => {
// if it doesn't get message back within 5min it'll close the request
req.setTimeout(300000);
bot.command("start", (ctx) => {
let text = ctx.message.text;
res.send(text);
});
});
app.listen(3000);