Getting ready...

Run http-rest-get.go, which we created in one of our previous recipes, in a separate terminal, executing the following command:

$ go run http-rest-get.go
See the Creating your first HTTP GET method recipe.

Verify whether the /employees service is running locally on port 8080 by executing the following command:

$ curl -X GET http://localhost:8080/employees

This should return the following response:

[{"id":"1","firstName":"Foo","lastName":"Bar"},{"id":"2","firstName":"Baz","lastName":"Qux"}]

Get Go Web Development Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.