Skip to main content

Api

How to Integrate Swagger UI in Go Backend - Gin Edition

Introduction # Unlike FastAPI, Gin does not have OpenAPI integration built in. With FastAPI when you add a route, documentation is already generated. With Gin, this is not the case. But recently I integrated Swagger UI in one of my Go backends and I wanted to document that process. Prerequisites # An already existing Gin server You might consider Building a Book Store API in Golang With Gin if you are starting from scratch. I’ll be using the same book store and extending over it to integrate Swagger UI.

Building a Book Store API in Golang With Gin

·9 mins
Introduction # Go community believes that we need no framework to develop web services. And I agree with that. When you work without using any framework, you learn the ins and outs of development. But once you learn how things work, you must reside in a community and don’t reinvent the wheel. I have created POCs in Go before and I had to deal with HTTP headers, serializing/deserializing, error handling, database connections, and whatnot. But now I’ve decided to join the Gin community as it is one of the widely accepted in the software development community.