go-urlsh/internal/app/routes.go

40 lines
1.3 KiB
Go

package app
import (
"code.lila.network/adoralaura/go-urlsh/internal/api"
"code.lila.network/adoralaura/go-urlsh/internal/web"
"github.com/gofiber/fiber/v2"
)
func addWebRoutes(f *fiber.App) {
f.Get("/admin/", web.HandleAdminLinkIndexGet)
f.Get("/admin/account/", web.HandleAdminAccountGet)
f.Get("/admin/account/mfasetup", web.HandleAdminAccountMFASetupGet)
f.Post("/admin/account/mfasetup", web.HandleAdminAccountMFASetupPost)
f.Delete("/admin/account/mfa", web.HandleAdminAccountMFARemove)
f.Get("/admin/login", web.HandleAdminLoginGet)
f.Post("/admin/login", web.HandleAdminLoginPost)
f.Get("/admin/login/multifactor", web.HandleAdminLoginMFAGet)
f.Post("/admin/login/multifactor", web.HandleAdminLoginMFAPost)
f.Get("/admin/", web.HandleAdminLinkIndexGet)
f.Get("/admin/links/new", web.HandleAdminLinkNewGet)
f.Get("/admin/links/edit/:id", web.HandleAdminLinkEditGet)
}
func addApiRoutes(r fiber.Router) {
r.Get("/links", api.HandleLinkGetAll)
r.Get("/links/:id", api.HandleLinkGet)
r.Put("/links/:id", api.HandleLinkPut)
r.Post("/links", api.HandleLinkPost)
r.Delete("/links/:id", api.HandleLinkDelete)
r.Get("/apikeys", api.HandleApiKeysGetAll)
r.Post("/apikeys", api.HandleApiKeysPost)
r.Delete("/apikeys/:id<guid>", api.HandleApiKeysPost)
r.Post("/users", api.HandleUserPost)
}