Write Hello World API with Swagger
You can start learning writing a Go API using mux package and NewRouter class function, but that really gives a very basic functionality which I did not find it appropriate if your goal is creating a REST API to use it as a product.
So this Hello World sample might be a little advance, but it worth it. I used a a library called go-swagger to implement this hello world api. Here is the instructions you can follow to create your first Hello World API or you can jump can have shortcut and browse the already implemented one in my helloworld-api Git Hub repo :
- First, install go-swagger. Follow this link https://goswagger.io/install.html
Here is the command using macOS Homebrew or Linux LinuxBrew :brew tap go-swagger/go-swagger brew install go-swagger