0

I'm new user of Node and Express

app.route('/book')
  .get(function (req, res) {
    res.send('Get a random book')
  })
  .post(function (req, res) {
    res.send('Add a book')
  })
  .put(function (req, res) {
    res.send('Update the book')
  })
   .delete(function (req, res) {
    res.send('Delete the book')
  });

for example, I have form HTML like:

<form action="/book" method="post">
...
</form>

When do I want to update the data, how does the Express know data should send for the PUT route also for Delete?

I could not send form data to PUT or Delete route. How I have to do that?

Mikel Williams
  • 441
  • 6
  • 21
  • possible duplicate: https://stackoverflow.com/questions/8054165/using-put-method-in-html-form btw, for `/book` there would only be GET, POST, whilst `/book/1` will have GET, PUT and DELETE – Lawrence Cherone Jan 10 '22 at 01:48

0 Answers0