From 7e03eeee38b268d79e1c501338da634e77859257 Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Tue, 16 Jul 2024 18:06:07 +0800 Subject: [PATCH] :rewind: Rollback api has no prefix --- pkg/internal/server/server.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/pkg/internal/server/server.go b/pkg/internal/server/server.go index fd9cba9..9db8bfe 100644 --- a/pkg/internal/server/server.go +++ b/pkg/internal/server/server.go @@ -16,10 +16,10 @@ import ( "github.com/spf13/viper" ) -var A *fiber.App +var app *fiber.App func NewServer() { - A = fiber.New(fiber.Config{ + app = fiber.New(fiber.Config{ DisableStartupMessage: true, EnableIPValidation: true, ServerHeader: "Hydrogen.Messaging", @@ -31,8 +31,8 @@ func NewServer() { EnablePrintRoutes: viper.GetBool("debug.print_routes"), }) - A.Use(idempotency.New()) - A.Use(cors.New(cors.Config{ + app.Use(idempotency.New()) + app.Use(cors.New(cors.Config{ AllowCredentials: true, AllowMethods: strings.Join([]string{ 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", Output: log.Logger, })) - A.Use(gap.H.AuthMiddleware) - A.Use(exts.LinkAccountMiddleware) + app.Use(gap.H.AuthMiddleware) + app.Use(exts.LinkAccountMiddleware) - api.MapAPIs(A, "/") + api.MapAPIs(app, "/api") } 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...") } }