Handling RouteNotFound error in HttpApiBuilder

Hey everyone, I'm new to the effect/platform module and I have two few questions regarding the http api where I could not find the answer in the docs:

(1) Handling RouteNotFound errors. The docs show an example for handling errors when you define the router explicitly. But how is it done if you use the HttpApiBuilder with the chainable API?

const SimpleApiGroupLive = HttpApiBuilder.group(SimpleApi, "root", (handlers) =>
  Effect.gen(function* () {
    return handlers
      .handle("get", () => Effect.succeed({ foo: "bar" as const }))
  }),
);


(2) Adding headers to groups / multiple endpoints. We have a header that we would like to add to whole API groups (a tenantId), but currently you can add errors to groups, but not headers. Is this correct?
Was this page helpful?