spud/daemon/api.go

29 lines
550 B
Go

package daemon
import (
"context"
"net/http"
)
func GetApiRoutes() map[string]HandlerFuncWithContext {
return map[string]HandlerFuncWithContext{
"/service": ServiceList,
}
}
func ServiceList(w http.ResponseWriter, r *http.Request, c context.Context) {
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)
}