chore: reorder api package structure

This commit is contained in:
DaanSelen
2026-04-23 15:43:39 +02:00
parent ea2a1730a4
commit 0556bc4932
6 changed files with 56 additions and 39 deletions
+4 -12
View File
@@ -3,23 +3,15 @@ package api
import (
"fmt"
"log/slog"
"orbits-server/internal/api/middleware"
"orbits-server/internal/api/routes"
"orbits-server/internal/utility"
"github.com/gin-gonic/gin"
"gorm.io/gorm"
)
const (
okMes string = "OK"
ieMes string = "An internal error occured, contact your administrator"
)
type RespObj struct {
Msg string `json:"msg"`
Data any `json:"data"`
}
// All error messages from slog must have an error field with the golang error
// See bottom the the kickoff function for details
@@ -34,10 +26,10 @@ func KickoffApi(logger *slog.Logger, env utility.Environment, db *gorm.DB) {
r.Use(gin.Recovery())
api := r.Group("/api")
spawnApiRoutes(api /*env,*/, db)
routes.RegisterApiRoutes(api /*env,*/, db)
file := r.Group("/file")
spawnFileRoutes(file, env, db)
routes.RegisterFileRoutes(file, env, db)
r.Static("/assets", "./web/frontend/dist/assets")
r.NoRoute(func(c *gin.Context) {