⏪ Rollback api has no prefix
This commit is contained in:
parent
768c809cbb
commit
7e03eeee38
@ -16,10 +16,10 @@ import (
|
|||||||
"github.com/spf13/viper"
|
"github.com/spf13/viper"
|
||||||
)
|
)
|
||||||
|
|
||||||
var A *fiber.App
|
var app *fiber.App
|
||||||
|
|
||||||
func NewServer() {
|
func NewServer() {
|
||||||
A = fiber.New(fiber.Config{
|
app = fiber.New(fiber.Config{
|
||||||
DisableStartupMessage: true,
|
DisableStartupMessage: true,
|
||||||
EnableIPValidation: true,
|
EnableIPValidation: true,
|
||||||
ServerHeader: "Hydrogen.Messaging",
|
ServerHeader: "Hydrogen.Messaging",
|
||||||
@ -31,8 +31,8 @@ func NewServer() {
|
|||||||
EnablePrintRoutes: viper.GetBool("debug.print_routes"),
|
EnablePrintRoutes: viper.GetBool("debug.print_routes"),
|
||||||
})
|
})
|
||||||
|
|
||||||
A.Use(idempotency.New())
|
app.Use(idempotency.New())
|
||||||
A.Use(cors.New(cors.Config{
|
app.Use(cors.New(cors.Config{
|
||||||
AllowCredentials: true,
|
AllowCredentials: true,
|
||||||
AllowMethods: strings.Join([]string{
|
AllowMethods: strings.Join([]string{
|
||||||
fiber.MethodGet,
|
fiber.MethodGet,
|
||||||
@ -48,19 +48,19 @@ func NewServer() {
|
|||||||
},
|
},
|
||||||
}))
|
}))
|
||||||
|
|
||||||
A.Use(logger.New(logger.Config{
|
app.Use(logger.New(logger.Config{
|
||||||
Format: "${status} | ${latency} | ${method} ${path}\n",
|
Format: "${status} | ${latency} | ${method} ${path}\n",
|
||||||
Output: log.Logger,
|
Output: log.Logger,
|
||||||
}))
|
}))
|
||||||
|
|
||||||
A.Use(gap.H.AuthMiddleware)
|
app.Use(gap.H.AuthMiddleware)
|
||||||
A.Use(exts.LinkAccountMiddleware)
|
app.Use(exts.LinkAccountMiddleware)
|
||||||
|
|
||||||
api.MapAPIs(A, "/")
|
api.MapAPIs(app, "/api")
|
||||||
}
|
}
|
||||||
|
|
||||||
func Listen() {
|
func Listen() {
|
||||||
if err := A.Listen(viper.GetString("bind")); err != nil {
|
if err := app.Listen(viper.GetString("bind")); err != nil {
|
||||||
log.Fatal().Err(err).Msg("An error occurred when starting server...")
|
log.Fatal().Err(err).Msg("An error occurred when starting server...")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user