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