0

I have an API which is an ivr, I already have the bodyparser configured and working perfectly in all the other routes.

However, when I make a post to a route that only enters in connection with the database to increase a variable that in this case we will call minutes, I get the following message

Cannot POST /voice/buyMinutes/

This same structure that you will see next is the one that I have in the other routes, and as I mention these work in a perfect way; however, in this specific part I can't make it run.

const bodyParser = require("body-parser");
const Router = require("express");
const userDb = require("../daos/user");

const route = Router();

const answerMessageRoute = route.post("/voice/buyMinutes", async (req, res) => {
    console.log(req.body);
    const minutesToRecharge = req.body.minutes;
    const userId = req.body.numBuzon;
    const user = userDb.queryByMailboxNumber(userId);
    await userDb.updateUser(user._id, "minutes", parseInt(minutesToRecharge));
    res.send("Pago realizado exitosamente");
});
jonrsharpe
  • 107,083
  • 22
  • 201
  • 376

0 Answers0