- 2
How would I resolve this 404 error?
We start at index.ejs (after the user logins in the app). I'd like to render my new.ejs page via the postings.js (router) file. I'd like the user to be able to get to new.ejs by clicking a button in index.ejs. Upon login, the url is http://localhost:####/login ====================== In app.js: const postingRouter = require('./routers/postings'); app.use('/postings', postingRouter); ====================== In index.ejs: <a href="postings/new"> <button type="button" id="create" class="btn btn-dark">Create posting</button> </a> ====================== In postings.js: router.get('/new', function (req, res) { res.redirect('new'); }) ====================== All ejs files on in the views folder.
2 Antworten
0
Solution:
in apps.js, change app.use('/postings', postingRouter); to app.use('/login/postings', postingRouter);
0
404 error is on your end. 5XX is on server end