So I'm using express and I was wondering if there was a way to use an array or chain the get request url for my routes. I been searching though documentation and came short. I figured I'd ask here before assuming it's not possible.
Currently this is how I deal with multiple routes that will render the same page.
app.get('/', function (req, res) {
res.render('home', {
title: 'Home Page Title'
});
});
app.get('/index.html', function (req, res) {
res.render('home', {
title: 'Home Page Title'
});
});
app.get('/home', function (req, res) {
res.render('home', {
title: 'Home Page Title'
});
});
As you can see, they all render the same page and title. It greatly increases my file size and makes it unfriendly to look though. Plus if I need to change how the page renders at the express routes level, I have to update multiple times.
Thanks for taking your time to help!
What about this: