First setup of a go server
This commit is contained in:
29
routes/routes.go
Normal file
29
routes/routes.go
Normal 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)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user