calendrier/routes/api.go

38 lines
1.1 KiB
Go

package routes
import (
"os"
"git.gnous.eu/Rick/calendrier/controllers"
jwtware "github.com/gofiber/contrib/jwt"
"github.com/gofiber/fiber/v2"
)
func SetupApi(app *fiber.App) {
app.Post("/user", controllers.CreateUser)
app.Post("/login", controllers.GetToken)
api := app.Group("/api/v1", jwtware.New(jwtware.Config{
SigningKey: jwtware.SigningKey{Key: []byte(os.Getenv("JWT_SECRET"))},
}))
//api := app.Group("/api/v1")
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)
*/
}