add swagger

This commit is contained in:
Fran Jurmanović
2024-07-11 18:49:14 +02:00
parent df70999d13
commit 8307a60913
9 changed files with 249 additions and 10 deletions

View File

@@ -7,7 +7,11 @@ import (
"os"
"github.com/gofiber/fiber/v2"
"github.com/gofiber/fiber/v2/middleware/cors"
"github.com/gofiber/swagger"
"github.com/joho/godotenv"
_ "acc-server-manager/docs"
)
func main() {
@@ -17,6 +21,10 @@ func main() {
Immutable: true,
})
app.Use(cors.New())
app.Get("/swagger/*", swagger.HandlerDefault)
file, err := os.OpenFile("logs.log", os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0666)
if err != nil {
log.Print("Cannot open file logs.log")