Skip to content

Commit

Permalink
Swagger UI Added
Browse files Browse the repository at this point in the history
  • Loading branch information
keyurboss committed Apr 10, 2024
1 parent 254b65d commit 250c2d1
Show file tree
Hide file tree
Showing 4 changed files with 1,504 additions and 0 deletions.
1 change: 1 addition & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ func InitFiberServer() {
},
})
app.Use(logger.New())
app.Static("/swagger", "./swagger")
apis.AddApis(app.Group("/v1", middleware.TokenDecrypter, middleware.AllowOnlyValidTokenMiddleWare))
app.Use(func(c *fiber.Ctx) error {
return c.Status(fiber.StatusNotFound).SendString("Sorry can't find that!")
Expand Down
23 changes: 23 additions & 0 deletions swagger/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="description" content="SwaggerUI" />
<title>SwaggerUI</title>
<link rel="stylesheet" href="https://unpkg.com/[email protected]/swagger-ui.css" />
</head>
<body>
<div id="swagger-ui"></div>
<script src="https://unpkg.com/[email protected]/swagger-ui-bundle.js" crossorigin></script>
<script>
window.onload = () => {
window.ui = SwaggerUIBundle({
// url: `${location.protocol}//${location.host}/swagger/swagger.json`,
url: '/swagger/swagger.json',
dom_id: '#swagger-ui',
});
};
</script>
</body>
</html>
Loading

0 comments on commit 250c2d1

Please sign in to comment.