29 lines
557 B
Go
29 lines
557 B
Go
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)
|
|
}
|
|
}
|
|
} |