I'm facing an issue where my css and js files do not load on the second route, but they work perfectly fine on the first route.
Could someone explain why this discrepancy occurs?
// ********************** INDEX PAGE *******************************************
app.get('/LimeLINE', (req, res) => {
let sTopHtml = fs.readFileSync(__dirname + '/components/top.html', 'utf8')
let sMainHtml = fs.readFileSync(__dirname + '/html/index.html', 'utf8')
let sBottomHtml = fs.readFileSync(__dirname + '/components/bottom.html', 'utf8')
// replace placeholders
sTopHtml = sTopHtml.replace('{{title}}', 'LimeLINE: Get Started')
res.send(sTopHtml + sMainHtml + sBottomHtml)
})
app.get('/LimeLINE/activate/:token', (req, res) => {
let sToken = req.params.token;
if (token === sToken) {
user.activateUser(res, sToken)
}
let sTopHtml = fs.readFileSync(__dirname + '/components/top.html', 'utf8')
let sMainHtml = fs.readFileSync(__dirname + '/html/index.html', 'utf8')
let sBottomHtml = fs.readFileSync(__dirname + '/components/bottom.html', 'utf8')
// replace placeholders
sTopHtml = sTopHtml.replace('{{title}}', 'LimeLINE: Welcome')
sMainHtml = sMainHtml.replace('{{click-trigger}}', 'click-trigger')
res.send(sTopHtml + sMainHtml + sBottomHtml)
})