I have a nodeJS server using Express. It uses a pug template. It displays a bunch of images. I want it to display a button on each image. When that button is pressed, the server deletes the image and the client refreshes.
here is what I have so far for the .pug:
// register form
block content
form(name="getomdb",method='post')
div.input
input(type="submit",name="delete", value="Delete " + link[0])
div.container
h3#title
p#plot
link[0] references the image I want to delete. As far as I can tell, what this is doing is sending a POST request to my server with the value "Delete " + link[0].
My server attempts to handle it:
app.post('/', function(req, res){
console.dir(req.body);
console.log('post got');
res.render('index.pug', { links: links})
});
Apparently, there is no body to the request (it prints undefined). How I access which specific link it is trying to delete?