Implementing a Restful API

The first step to utilize the package is to make use of the go get command in order to obtain the package to our development environment:

$ go get

With that, the mux package will be ready to use. In our code, we can now import the mux package to our web server code:

import ""

Inside our code, we now need to create a router using the Gorilla mux package. This is accomplished via the following code:

r := mux.NewRouter()

With this, we will get a router object called r, to help us define our routes and link them with actions to execute.

From this point forward, the code will differ based on the microservice in question since different services will support different routes ...

Get Cloud Native programming with Golang now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.