I have an SPA made with express-handlebars. I need to pass route parameters in the URL so I can pick it up in the subsequent page it leads to and render the details pertaining to that parameter. for eg.
www.sitename.com/events/1
, www.sitename.com/events/2
1 and 2 will be the event IDs which I will then use to fetch the details of that event.
I need handlebars to render the same eventdetail
page for me for both routes as shown above. But it seems to break everything, and the console check showed me that it was trying to go inside a "events" folder and then trying to find all the files within and eventually throwing a 404 page as well.
These are the routes I have right now in my routes.js page.
router.get("/events", function(req, res, next) {
res.render("events");
});
router.get("/eventdetail", function(req, res, next) {
res.render("eventdetail");
});
How do I go about with this?