Closed ghost closed 6 years ago
what route does it say it cannot post to?
can you make sure your code is pushed? I'm not seeing any routes in your code.
Try these fixes...
In
index.js
app.set('view engine', 'hbs')
app.engine('.hbs', hbs({
extname: '.hbs',
partialsDir: 'views/',
layoutsDir: 'views/',
defaultLayout: 'layout-main'
}))
In
routesController.js
...
router.get('/', (req,res) => {
Snap.find({})
.then((snaps) => {
- res.render('/show-all', { snaps })
+ res.render('show-all', { snaps })
})
})
Hey Rindy -- couple more things:
res.redirect
rather than res.render
within the bodies of your non get
requestspost
for create routes and put
for update routesget
and post
I tried setting up my CRUD functionality. I expected something to happen. Nothing happened instead. When I click Remove/Add buttons it says localhost says "Cannot Post"
My repo link is https://github.com/rnunes00/project2-Eco-Snap and my question is about lines routes.js file.