I am learning react and express framework from NodeSchool.io exercises.
I want to store all exercise files in single application with multiple pages like
index
index2
index3
index4
....
localhost:3000/indexN
But I am unable to set the route for such URLs. Project repo: Git Public Repo URL
Tried various things but could not resolve the issue.
How to configure dynamic routes with express.js
app.use("/indexn*", function(req, res) {
res.render("indexn", "");
});
API kind of solution works as below but this was also not helpful as its parameterized URL
// http://localhost:3000/index/2
app.get('/index/:id', function(req , res){
res.render('index' + req.params.id, "");
});
I also tried various RegEx patterns in above function like
(index)n, index:n*
but compilation fails.
Thanks for your help.