I am currently exploring ways to check if a URL string is present in an express application, in order to initiate a theme change.
At the moment, I have a basic router.get function:
router.get('/', function(req, res, next) {
res.render('index', { title: 'Home' });
});
My goal is to check the URL for a specific string, such as "Toy", and based on that, somehow trigger jade/pug to display a different graphic.
store.org
trigger main Graphic
toystore.org
trigger a different graphic
Then, I need to pass this information so that I can adjust the theme in pug/jade. What are your thoughts on this approach?
I was considering using string.match along with regex to search for the desired trigger, but that may not work as I need to modify it to change the theme in pug/jade.