Deployed link is not accepting post request

I am making below post request , from frontend it is successful…when run on local backend server giving correct output but when deployed on render server , it is not accepting post requests. Please resolve the issue as soon as possible

app.post(‘/prescription’,(req,res)=>{

console.log("Request printing...")
const pres = req.body;
const prescription = new Prescription({ 
    pid:pres.m_num,
    dob: pres.DOB,
    visit_no: pres.Visit_No,
    name : pres.Name,
    address: pres.Address,
    age : pres.Age,
    sex : pres.Sex, 
    mobile_no : pres.m_num,
    diagnosis :pres.Diagnosis,
    goal_for_next_month : pres.Goal,
    prescription: pres.Prescription,
    payment_receipt : pres.Receipt,
    description : pres.Description
});
console.log(prescription)
prescription
    .save()
    .then(
        () => console.log("One Prescription added"), 
        (err) => console.log(err.message)
    );
    res.send("Post request sent");

})

Hi there,

We cannot offer much in the way of code advice. What I can say is that it sounds like you might be forgetting to change the base URL from localhost to the backend service’s onrender.com URL.

That would be the first thing I recommend checking.

Regards,
Mike


Render Support Engineer, MT (UTC-6, UTC-7 in Winter)

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.