Node.js Express DELETE route not working -


when trying delete item returns: cannot /posts

routes.js

app.delete('/posts/:id', function(req, res){     console.log("deleting");     post.findbyid( req.params.id, function ( err, post ){         post.remove( function ( err, post ){             res.render('posts.ejs');         });     }); }); 

posts.ejs

<% posts.foreach( function( post ){ %>                 <p><%= post._id %></p>                 <p><%= post.title %></p>                 <p><%= post.content %></p>                 <a href="/posts/<%= post._id %>" method='delete'>delete</a>             <% }); %>     

any pointers appreciated :) thanks

html a element doesn't have method attribute. check legal attributes list. means links get.

if want send delete request using browser option use ajax.


Comments

Popular posts from this blog

hibernate - How to load global settings frequently used in application in Java -

python 3.x - Mapping specific letters onto a list of words -

objective c - Ownership modifiers with manual reference counting -