0
I have several (practically all) urls, which point to a single page and use the following line to send the file:
app.get('*', function(req, res){
res.sendFile(__dirname+'/home.html');
});
But with this,also files that I request from my site and etc, are redirected to home, I would not like to have to create a new line for each requested url, so:
app.get('/urlA', function(req, res){
res.sendFile(__dirname+'/home.html');
});
app.get('/urlB', function(req, res){
res.sendFile(__dirname+'/home.html');
});
It would be possible to do something like the code below?
app.get('/urlA, /urlB', function(req, res){
res.sendFile(__dirname+'/home.html');
});
Try
app.get('/(urlA|urlB)', function(req, res) { ... }
– Costamilam
I get Invalid regular Expression when I try to do this
– Leo Letto