First setup of a go server

This commit is contained in:
2026-01-23 20:05:23 +01:00
parent 6202b585e7
commit 3f11bad8f6
8 changed files with 412 additions and 0 deletions

29
routes/routes.go Normal file
View File

@@ -0,0 +1,29 @@
package routes
import (
"sheetless-server/handlers"
"sheetless-server/middleware"
"github.com/gin-gonic/gin"
)
func SetupRoutes(r *gin.Engine) {
// Public routes
auth := r.Group("/auth")
{
auth.POST("/register", handlers.Register)
auth.POST("/login", handlers.Login)
}
// Protected routes
api := r.Group("/api")
api.Use(middleware.AuthMiddleware())
{
sheets := api.Group("/sheets")
{
sheets.POST("/upload", handlers.UploadSheet)
sheets.GET("", handlers.ListSheets)
sheets.GET("/download/:id", handlers.DownloadSheet)
}
}
}