calendrier/routes/api.go

39 lines
1.1 KiB
Go
Raw Normal View History

2024-02-17 13:25:03 +01:00
package routes
import (
"os"
2024-02-17 13:25:03 +01:00
"git.gnous.eu/Rick/calendrier/controllers"
jwtware "github.com/gofiber/contrib/jwt"
2024-02-17 13:25:03 +01:00
"github.com/gofiber/fiber/v2"
)
func SetupApi(app *fiber.App) {
app.Post("/user", controllers.CreateUser)
app.Post("/login", controllers.GetToken)
2024-02-24 16:01:08 +01:00
api := app.Group("/api/v1", jwtware.New(jwtware.Config{
SigningKey: jwtware.SigningKey{Key: []byte(os.Getenv("JWT_SECRET"))},
}))
//api := app.Group("/api/v1")
2024-02-17 13:25:03 +01:00
api.Get("/calendars", controllers.GetCalendars)
api.Get("/calendar/:id<int>", controllers.GetCalendar)
api.Post("/calendar", controllers.PostCalendar)
/*
api.Put("/calendar/:id<int>/visibility", controllers.PutVisibilityCalendar)
api.Delete("/calendar/:id<int>", controllers.DeleteCalendar)
api.Get("/calendar/:id<int>/events", controllers.GetCalendarEvents)
api.Post("/calendar/:id<int>/event/:id<int>", controllers.PostCalendarEvent)
api.Get("/event/:id<int>", controllers.GetEvent)
api.Post("/event/:id<int>", controllers.PostEvent)
api.Put("/event/:id<int>", controllers.PutEvent)
api.Delete("/event/:id<int>", controllers.DeleteEvent)
*/
}