go: add a handler for admin endpoint(s)
This commit is contained in:
parent
5cfad662fc
commit
5937a24ad9
@ -3,6 +3,7 @@ package app
|
|||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
|
"git.dotya.ml/mirre-mt/pcmt/handlers"
|
||||||
"github.com/labstack/echo/v4"
|
"github.com/labstack/echo/v4"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -15,4 +16,7 @@ func (a *App) SetupRoutes() {
|
|||||||
e.HEAD("/", func(c echo.Context) error {
|
e.HEAD("/", func(c echo.Context) error {
|
||||||
return c.NoContent(http.StatusOK)
|
return c.NoContent(http.StatusOK)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// administrative endpoints.
|
||||||
|
e.GET("/admin", handlers.Admin())
|
||||||
}
|
}
|
||||||
|
13
handlers/handlers.go
Normal file
13
handlers/handlers.go
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
package handlers
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/labstack/echo/v4"
|
||||||
|
)
|
||||||
|
|
||||||
|
func Admin() echo.HandlerFunc {
|
||||||
|
return func(c echo.Context) error {
|
||||||
|
return echo.NewHTTPError(http.StatusUnauthorized, "Invalid credentials")
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user