{"id":248,"date":"2018-11-29T01:11:17","date_gmt":"2018-11-29T01:11:17","guid":{"rendered":"http:\/\/kabiliravi.com\/?page_id=248"},"modified":"2019-07-21T13:48:23","modified_gmt":"2019-07-21T13:48:23","slug":"write-hello-world-api-with-swagger","status":"publish","type":"page","link":"http:\/\/kabiliravi.com\/index.php\/software\/programming\/my-go-tutorial\/write-hello-world-api-with-swagger\/","title":{"rendered":"Write Hello World API with Swagger"},"content":{"rendered":"<p>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.<\/p>\n<p>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 <a href=\"https:\/\/github.com\/gotutorial\/helloworld-api.git\">helloworld-api Git Hub repo<\/a>&nbsp;:<\/p>\n<ol>\n<li>First,&nbsp;install go-swagger. Follow this link&nbsp;https:\/\/goswagger.io\/install.html<br \/>\nHere is the command using macOS Homebrew or Linux LinuxBrew :<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">brew tap go-swagger\/go-swagger\r\nbrew install go-swagger<\/pre>\n<\/li>\n<li>&nbsp;&nbsp;<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>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 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":131,"menu_order":6,"comment_status":"open","ping_status":"closed","template":"","meta":{"ngg_post_thumbnail":0,"footnotes":""},"class_list":["post-248","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"http:\/\/kabiliravi.com\/index.php\/wp-json\/wp\/v2\/pages\/248","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/kabiliravi.com\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"http:\/\/kabiliravi.com\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"http:\/\/kabiliravi.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/kabiliravi.com\/index.php\/wp-json\/wp\/v2\/comments?post=248"}],"version-history":[{"count":7,"href":"http:\/\/kabiliravi.com\/index.php\/wp-json\/wp\/v2\/pages\/248\/revisions"}],"predecessor-version":[{"id":257,"href":"http:\/\/kabiliravi.com\/index.php\/wp-json\/wp\/v2\/pages\/248\/revisions\/257"}],"up":[{"embeddable":true,"href":"http:\/\/kabiliravi.com\/index.php\/wp-json\/wp\/v2\/pages\/131"}],"wp:attachment":[{"href":"http:\/\/kabiliravi.com\/index.php\/wp-json\/wp\/v2\/media?parent=248"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}