I have nodejs express backend using static file management, one html file where i have 2 divs. For root route i want to display div1 and for the any other route i want to display div2. How can i do that?
index.js
app.use('/', express.static(path.join(__dirname, '..', 'client')))
app.get('/:gameCode', (req, res) => {
res.sendFile(path.join(__dirname, '..', 'client'))
// but with visible div2 and invisible div1
})
index.html
<div1 class="active">div1</div1>
<div2 class="inactive">div2</div2>
style.css
.active { display: block }
.inactive { display: none }
I can't do it with 2 different html files