the shrimplest admin api you've ever seen

Signed-off-by: ari melody <ari@arimelody.me>
This commit is contained in:
ari melody 2024-04-16 22:58:39 +01:00
parent 1cbcece3d2
commit c5a2491627
5 changed files with 266 additions and 12 deletions

20
api/api.go Normal file
View file

@ -0,0 +1,20 @@
package api
import (
"net/http"
"html/template"
"arimelody.me/arimelody.me/api/v1/admin"
)
func Handle(writer http.ResponseWriter, req *http.Request, root *template.Template) int {
code := 404;
if req.URL.Path == "/api/v1/admin/login" {
code = admin.HandleLogin(writer, req, root)
}
if code == 404 {
writer.Write([]byte("404 not found"))
}
return code;
}