chore: init Vue

This commit is contained in:
DaanSelen
2026-04-21 08:42:21 +02:00
parent 4b783b50fb
commit 610fdffdb8
20 changed files with 1645 additions and 60 deletions
+5 -5
View File
@@ -27,10 +27,10 @@ func categorizeFile(ext string) string {
}
}
func spawnRoutes(r *gin.Engine, env runtime.Environment, db *gorm.DB) {
func spawnRoutes(api *gin.RouterGroup, env runtime.Environment, db *gorm.DB) {
// The Root endpoint '/' displays a simple HTML template.
// from root: ./templates/index.html
r.GET("/", func(c *gin.Context) {
api.GET("/", func(c *gin.Context) {
c.HTML(http.StatusOK, "index.html",
gin.H{
"title": env.Codename,
@@ -41,7 +41,7 @@ func spawnRoutes(r *gin.Engine, env runtime.Environment, db *gorm.DB) {
// prefix: api
// Display the information on what is going on at the moment
r.GET("/api/status", func(c *gin.Context) {
api.GET("/api/status", func(c *gin.Context) {
state, err := database.GetAppState(db)
if err != nil {
slog.Warn("unable to determine state")
@@ -51,7 +51,7 @@ func spawnRoutes(r *gin.Engine, env runtime.Environment, db *gorm.DB) {
})
// define the upload route
r.POST("/api/upload", func(c *gin.Context) {
api.POST("/api/upload", func(c *gin.Context) {
file, err := c.FormFile("file")
if err != nil {
slog.Error("missing file upload", "error", err)
@@ -74,7 +74,7 @@ func spawnRoutes(r *gin.Engine, env runtime.Environment, db *gorm.DB) {
})
// define a route to check what is registered
r.GET("/api/available", func(c *gin.Context) {
api.GET("/api/available", func(c *gin.Context) {
files, err := database.GetFiles(db)
if err != nil {
slog.Error("failed to retrieve available files", "error", err)