# knife4g **Repository Path**: snac21/knife4g ## Basic Information - **Project Name**: knife4g - **Description**: No description available - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-03-07 - **Last Updated**: 2025-05-30 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Knife4g use knife4j-front to show the api documents for gin # Usage 1. Add comments to your API source code 2. Download [Swag](https://github.com/swaggo/swag) for Go by using: 3. Run `swag init -ot json` in your project directory 4. Run `go get github.com/hononet639/knife4g` 5. Add router to your gin project ### example: ```go package main import ( "github.com/gin-gonic/gin" "github.com/hononet639/knife4g" ) func main() { engine := gin.Default() engine.GET("/doc/*any", knife4g.Handler(knife4g.Config{RelativePath: "/doc"})) engine.Run(":80") } ``` 6. Visit http://localhost/doc/index # Acknowledgement Thanks to [knife4j](https://github.com/xiaoymin/swagger-bootstrap-ui)