I currently have a NodeJS application with an Express backend and all the frontend implemented with EJS. An example route looks like this currently:
router.get("/:name&:term", function(req, res) {
Course.find({ courseName: req.params.name, courseTerm: req.params.term }).populate("students")
.exec(function(err, foundCourse) {
if (err) {
console.log(err);
} else {
console.log(foundCourse)
res.render("courses/show", { course: foundCourse });
}
});
});
I have a lot of the pages of the website already implemented following the example route above. So the structure looks something like:
localhost:3000
-/courses
-/show
-/review
-/professors
-/show
-/rating
...
But I recently took a React course and want to use React for new pages like localhost:3000/groups
Is there a way to use React for some pages and still have EJS pages that I currently have? or do I have to rewrite all the EJS pages to React components? I'm still very new to web dev so any advice would be highly appreciated.
From my understanding, I would have to let the React app catch only certain requests/routes but I am not quite sure how to do that.