busybar / internal / auth / routes.go
routes.go
Raw
package auth

import "github.com/labstack/echo/v4"

func CreateRouteGroups(e *echo.Echo) (*echo.Group, *echo.Group, *echo.Group) {

	// PUBLIC ROUTES
	// - without authentication
	// - healthcheck, etc.
	public := e.Group("")

	// USER ROUTES
	// - with authentication
	user := e.Group("")
	user.Use(Authenticate)

	// ADMIN ROUTES
	// - with authentication
	// - only for admins
	admin := user.Group("")
	admin.Use(RequireAdmin)

	return public, user, admin
}