O'Reilly logo

Go Web Development Cookbook by Arpit Aggarwal

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

How it works…

Once we run the program, the HTTP server will start locally listening on port 8080

Next, executing a DELETE request from the command line as follows, will delete an employee with ID 1 and give us the updated list of employees:

$ curl -H "Content-Type: application/json" -X DELETE -d '{"Id":"1", "firstName": "Foo", "lastName": "Bar"}' http://localhost:8080/employee/delete

 This can be seen in the following screenshot:

Let’s understand the change we introduced in this recipe:

  1. First, we added another route with the name deleteEmployee, which executes the deleteEmployee handler for every DELETE request for the URL pattern /employee/delete ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required