diff --git a/pkg/internal/embed.go b/pkg/internal/embed.go deleted file mode 100644 index 38dd3ff..0000000 --- a/pkg/internal/embed.go +++ /dev/null @@ -1,6 +0,0 @@ -package pkg - -import "embed" - -//go:embed views/* -var FS embed.FS diff --git a/pkg/internal/server/api/index.go b/pkg/internal/server/api/index.go index 1fb7504..6f483de 100644 --- a/pkg/internal/server/api/index.go +++ b/pkg/internal/server/api/index.go @@ -4,8 +4,8 @@ import ( "github.com/gofiber/fiber/v2" ) -func MapAPIs(app *fiber.App) { - api := app.Group("/api").Name("API") +func MapAPIs(app *fiber.App, baseURL string) { + api := app.Group(baseURL).Name("API") { api.Get("/users/me", getUserinfo) api.Get("/users/:accountId", getOthersInfo) diff --git a/pkg/internal/server/server.go b/pkg/internal/server/server.go index 21cfbf7..9541eb7 100644 --- a/pkg/internal/server/server.go +++ b/pkg/internal/server/server.go @@ -1,28 +1,23 @@ package server import ( - pkg "git.solsynth.dev/hydrogen/interactive/pkg/internal" + "strings" + "git.solsynth.dev/hydrogen/interactive/pkg/internal/gap" "git.solsynth.dev/hydrogen/interactive/pkg/internal/server/api" "git.solsynth.dev/hydrogen/interactive/pkg/internal/server/exts" "github.com/gofiber/fiber/v2" "github.com/gofiber/fiber/v2/middleware/cors" - "github.com/gofiber/fiber/v2/middleware/favicon" "github.com/gofiber/fiber/v2/middleware/idempotency" "github.com/gofiber/fiber/v2/middleware/logger" - "github.com/gofiber/template/html/v2" jsoniter "github.com/json-iterator/go" "github.com/rs/zerolog/log" "github.com/spf13/viper" - "net/http" - "strings" ) var A *fiber.App func NewServer() { - templates := html.NewFileSystem(http.FS(pkg.FS), ".gohtml") - A = fiber.New(fiber.Config{ DisableStartupMessage: true, EnableIPValidation: true, @@ -33,8 +28,6 @@ func NewServer() { JSONDecoder: jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal, BodyLimit: 50 * 1024 * 1024, EnablePrintRoutes: viper.GetBool("debug.print_routes"), - Views: templates, - ViewsLayout: "views/index", }) A.Use(idempotency.New()) @@ -62,19 +55,7 @@ func NewServer() { A.Use(gap.H.AuthMiddleware) A.Use(exts.LinkAccountMiddleware) - A.Use(favicon.New(favicon.Config{ - FileSystem: http.FS(pkg.FS), - File: "views/favicon.png", - URL: "/favicon.png", - })) - - api.MapAPIs(A) - - A.Get("/", func(c *fiber.Ctx) error { - return c.Render("views/open", fiber.Map{ - "frontend": viper.GetString("frontend"), - }) - }) + api.MapAPIs(A, "/") } func Listen() { diff --git a/pkg/internal/views/favicon.png b/pkg/internal/views/favicon.png deleted file mode 100644 index 5fd052d..0000000 Binary files a/pkg/internal/views/favicon.png and /dev/null differ diff --git a/pkg/internal/views/index.gohtml b/pkg/internal/views/index.gohtml deleted file mode 100644 index 68f74eb..0000000 --- a/pkg/internal/views/index.gohtml +++ /dev/null @@ -1,28 +0,0 @@ - - -
- - - - - - - - - - -
- Hold on a second...
- We are redirecting you to our application...
-