-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
55 lines (43 loc) · 1.34 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package main
import (
"fiber-gateway/config"
"fiber-gateway/router"
"github.com/gofiber/fiber/v2"
"github.com/gofiber/fiber/v2/middleware/logger"
"github.com/gofiber/fiber/v2/middleware/monitor"
"github.com/gofiber/swagger"
)
// @title Fiber Gateway API
// @version 1.0
// @description Documentation for Fiber Gateway API
// @termsOfService http://swagger.io/terms/
// @contact.name Fiber Gateway Support
// @contact.url http://www.swagger.io/support
// @contact.email [email protected]
// @license.name Apache 2.0
// @license.url http://www.apache.org/licenses/LICENSE-2.0.html
// @securityDefinitions.apikey BearerAuth
// @in header
// @name Authorization
// @description Type "Bearer" followed by a space and JWT token.
func main() {
//Default
//AllowOrigins: "*",
//AllowMethods: "GET, POST, PATCH, HEAD, PUT, DELETE,"
//AllowHeaders: ""
//AllowCredentials: false
app := fiber.New()
// Initialize default config (Assign the middleware to /metrics)
app.Get("/metrics", monitor.New())
// Gen swagger API documents
app.Get("/swagger/*", swagger.HandlerDefault) // default
// Initialize default config
app.Use(logger.New(logger.Config{}))
//Initialize connect to database
// gorm.Connection()
// gorm.AutoMigration()
// defer gorm.Disconnection()
// Initialize router
router.New(app)
app.Listen(":" + config.Env("PORT", "3002"))
}