1

My search route in node redirects back to the same page, and that page cannot see my assets folder containing my css. All other routes and pages have no issue.

Setup of express

app.set('views', path.join(__dirname, 'views'));
app.set('assets', path.join(__dirname, 'assets'));
app.set('clients', path.join(__dirname, 'clients'));

app.set('view engine', 'ejs')
app.use(express.static('assets'));
app.use(express.static('clients'));

The search route - is being called on the stream page.

// Searching for a streams associated with a user email 
router.get('/search',
    loggedIn,
    async (req, res) => {

        email = req.query.email;

        await Schedule.find({ownerEmail: email}, (err, founddoc) =>{

            if (err) throw console.log("error: "+ err);

            res.render('stream', {
                loggedInUser: req.user.username,
                loggedInUserRole: req.user.role,
                streams: founddoc
            });

    });
});

Works - http://127.0.0.1:3000/stream Doesn't work - http://127.0.0.1:3000/stream/search?

Application Tree For Reference

0 Answers0