Endpoint to delete a note

We’ll have to list all our notes. We’ll use DELETE method as we’ll use it to send data to server to delete existing data.

  1. Go to workspace page and select “new endpoint”.
  2. Name the endpoint as “deleteNotes” and url as “/notes/delete/”.
  3. We’ll use DELETE method here as we want to send data and delete existing data.
  4. Select “save” to create your endpoint.
  5. Now we’ll use fetch One block to get the particular note to be edited.
  6. Drag and drop a “database fetch one” block and select “note” table in table name and give variable name as note.
  7. Add condition for id to fetch the note. Use dot operator to extract id from the data variable for the id field. {{data.id}}
  8. Drag and drop a database delete block to update the note.
  9. Name variable as note (same as fetch one block variable) and save the block.
  10. Drag and drop a response block and select 200 status code to send a success response and save the response block.
  11. Deploy the project

# Test it out

Once the project is launched in browser, try deleting the a note using delete link in note entry.

# Further Reading

To read about more blocks read our documentation.