Routes returns the HTTP handler for process-related routes.
()
| 52 | |
| 53 | // Routes returns the HTTP handler for process-related routes. |
| 54 | func (api *API) Routes() http.Handler { |
| 55 | r := chi.NewRouter() |
| 56 | r.Post("/start", api.handleStartProcess) |
| 57 | r.Get("/list", api.handleListProcesses) |
| 58 | r.Get("/{id}/output", api.handleProcessOutput) |
| 59 | r.Post("/{id}/signal", api.handleSignalProcess) |
| 60 | return r |
| 61 | } |
| 62 | |
| 63 | // handleStartProcess starts a new process. |
| 64 | func (api *API) handleStartProcess(rw http.ResponseWriter, r *http.Request) { |