spud/daemon/api.go

30 lines
550 B
Go
Raw Normal View History

2024-10-02 02:56:25 +00:00
package daemon
import (
"context"
2024-10-02 02:56:25 +00:00
"net/http"
)
func GetApiRoutes() map[string]HandlerFuncWithContext {
return map[string]HandlerFuncWithContext{
2024-10-02 02:56:25 +00:00
"/service": ServiceList,
}
}
func ServiceList(w http.ResponseWriter, r *http.Request, c context.Context) {
2024-10-02 02:56:25 +00:00
var returnPayload []byte
var returnCode int
switch r.Method {
case "POST":
returnPayload = []byte("Create service: Not implemented")
returnCode = 501
default:
returnPayload = []byte("Not implemented")
returnCode = 501
}
w.WriteHeader(returnCode)
w.Write(returnPayload)
}