I have the following code in my routes.
app.get("/thispage/:subscriber/:id_code", (req, res) => {
const id_code=req.params.id_code;
const subscriber=req.params.subscriber;
MongoClient.connect(mongoString, async function(err, db) {
const subscriber_pid=subscriber + "_pid";
if (err) throw err;
const dbo = db.db("product_dbase");
dbo.collection(subscriber_pid).findOne({_id:ObjectID(id_code)})
.then (result => {
res.render("thispage", {title : "Layout", record : result});
})
});
})
Works fine. Comes from a series of links on another page so that each of them carries the subscriber and the id of the link clicked.
The issue I have is that the parameter sticks in the URL so it is there to see and I’d rather it wasn’t. Have used window.history.pushState but its a bit flaky and then needs 2 clicks to go back. I can’t figure out a way to strip the params from the URL, use the details and then show only the shortened url. Does anyone have any bright ideas? TIA