From 83df95435cf518b1bd8026c3d39986f47fd2e137 Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Tue, 16 Jul 2024 17:02:16 +0800 Subject: [PATCH] :truck: Move api path --- pkg/internal/server/api/index.go | 4 ++-- pkg/internal/server/server.go | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/pkg/internal/server/api/index.go b/pkg/internal/server/api/index.go index 55586af..bd13f4a 100644 --- a/pkg/internal/server/api/index.go +++ b/pkg/internal/server/api/index.go @@ -2,10 +2,10 @@ package api import "github.com/gofiber/fiber/v2" -func MapAPIs(app *fiber.App) { +func MapAPIs(app *fiber.App, baseURL string) { app.Get("/.well-known/destinations", getDestinations) - api := app.Group("/api").Name("API") + api := app.Group(baseURL).Name("API") { api.Get("/attachments/:id/meta", getAttachmentMeta) api.Get("/attachments/:id", openAttachment) diff --git a/pkg/internal/server/server.go b/pkg/internal/server/server.go index 40dffd0..b0c62e2 100644 --- a/pkg/internal/server/server.go +++ b/pkg/internal/server/server.go @@ -1,10 +1,11 @@ package server import ( + "strings" + "git.solsynth.dev/hydrogen/paperclip/pkg/internal/gap" "git.solsynth.dev/hydrogen/paperclip/pkg/internal/server/api" "git.solsynth.dev/hydrogen/paperclip/pkg/internal/server/exts" - "strings" "github.com/gofiber/fiber/v2" "github.com/gofiber/fiber/v2/middleware/cors" @@ -55,7 +56,7 @@ func NewServer() { A.Use(gap.H.AuthMiddleware) A.Use(exts.LinkAccountMiddleware) - api.MapAPIs(A) + api.MapAPIs(A, "/") } func Listen() {