mirror of
https://github.com/kaaninchen/Laterna.git
synced 2026-09-17 19:12:48 +00:00
22 lines
475 B
Go
22 lines
475 B
Go
package routes
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/siestaw/laterna/server/cmd/internal/db"
|
|
"github.com/siestaw/laterna/server/cmd/utils"
|
|
)
|
|
|
|
func RegisterAdminRoutes(mux *http.ServeMux) {
|
|
mux.HandleFunc("POST /api/v1/admin/controllers", createController)
|
|
}
|
|
|
|
func createController(w http.ResponseWriter, r *http.Request) {
|
|
auth := r.Header.Get("Authorization")
|
|
if !db.IsAdmin(auth) {
|
|
utils.HTTPErrorHandling(w, r, http.StatusUnauthorized, "Invalid token")
|
|
return
|
|
}
|
|
|
|
}
|