Add API endpoint response

This commit is contained in:
Melon 2023-10-17 00:11:44 +01:00
parent e87809849e
commit f268656b20
Signed by: melon
GPG Key ID: 6C9D970C50D26A25

View File

@ -18,6 +18,10 @@ import (
func NewApiServer(conf *conf.Conf, compileTarget utils.MultiCompilable) *http.Server { func NewApiServer(conf *conf.Conf, compileTarget utils.MultiCompilable) *http.Server {
r := httprouter.New() r := httprouter.New()
r.GET("/", func(rw http.ResponseWriter, req *http.Request, params httprouter.Params) {
http.Error(rw, "Violet API Endpoint", http.StatusOK)
})
// Endpoint for compile action // Endpoint for compile action
r.POST("/compile", checkAuthWithPerm(conf.Signer, "violet:compile", func(rw http.ResponseWriter, req *http.Request, _ httprouter.Params, b AuthClaims) { r.POST("/compile", checkAuthWithPerm(conf.Signer, "violet:compile", func(rw http.ResponseWriter, req *http.Request, _ httprouter.Params, b AuthClaims) {
// Trigger the compile action // Trigger the compile action