def Serve.route

bend-kube-runtime@0.2.0.0 · src/serve.bend:167

import bend-kube-runtime@0.2.0.0/src/serve.bend as Serve
import Base
import bend-kube-runtime@0.2.0.0/src/runtime.bend as R

167# The answer to a request.
168def Serve.route(path: String, +status: Chan(R.SMsg)) -> IO(String):
169  match path:
170    case "/healthz":
171      IO.pure(String, Serve.reply(200, "text/plain", "ok\n"))
172    case "/readyz":
173      IO.bind(List<&2, R.Snap>, String, Serve.probe(status), m => IO.pure(String, Serve.ready(m)))
174    case "/metrics":
175      IO.bind(List<&2, R.Snap>, String, Serve.probe(status), m => IO.pure(String, Serve.metrics(m)))
176    case _:
177      IO.pure(String, Serve.reply(404, "text/plain", "not found\n"))

Uses (17)

Used by (1)