Reputation: 15
I'm trying to create a CRUD app using Node and express, i'm relatively new to it. I have an ideas page and an edit button on each idea. I keep on getting the error "Cannot GET /ideas/edit1/" when I click the edit button(this view exists by the way).
Here's the code I used to edit data in a form:
app.get('/ideas/edit/:id', (req, res) => {
Idea.findOne({
_ id: req.params.id
})
.then(idea => {
res.render('ideas/edit1', {
idea: idea
});
});
})
I have checked the express documentation and i'm pretty sure express uses the : to denote a variable in a route.
I'm wondering what else to do.
Upvotes: 0
Views: 1352
Reputation:
Instead of res.render('ideas/edit1' you should be using res.render('ideas/edit/1')
Upvotes: 1