feat(docs): Swagger generation
This commit is contained in:
8
main.go
8
main.go
@@ -4,8 +4,10 @@ import (
|
||||
"flag"
|
||||
"log"
|
||||
|
||||
"git.odit.services/lfk/document-server/docs" // Correct import path for docs
|
||||
"git.odit.services/lfk/document-server/handlers"
|
||||
"github.com/gofiber/fiber/v2"
|
||||
"github.com/gofiber/swagger"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -13,6 +15,8 @@ var (
|
||||
prod = flag.Bool("prod", false, "Enable prefork in Production")
|
||||
)
|
||||
|
||||
// @title LfK Document Server API
|
||||
// @description This is the API documentation for the LfK Document Server - a tool for pdf generation.
|
||||
func main() {
|
||||
// Parse command-line flags
|
||||
flag.Parse()
|
||||
@@ -22,6 +26,9 @@ func main() {
|
||||
Prefork: *prod,
|
||||
})
|
||||
|
||||
// Swagger documentation route
|
||||
app.Get("/swagger/*", swagger.HandlerDefault)
|
||||
|
||||
v1 := app.Group("/v1")
|
||||
|
||||
v1.Get("/", func(c *fiber.Ctx) error {
|
||||
@@ -30,6 +37,7 @@ func main() {
|
||||
v1.Post("/contracts", handlers.GenerateContract)
|
||||
|
||||
app.Use(handlers.NotFoundHandler)
|
||||
docs.SwaggerInfo.BasePath = "/"
|
||||
|
||||
log.Fatal(app.Listen(*port))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user