Effect CommunityEC
Effect Community8mo ago
6 replies
bastian

How to Set Cookies in `HttpApiGroup` and `HttpApiBuilder` Handlers

Does someone know how to set cookies when I use HttpApiGroup and HttpApiBuilder like in the following example?

export class ConnectApiGroup extends HttpApiGroup.make("connect")
  .add(HttpApiEndpoint.post("market", "/market").addSuccess().setPayload())
  .middleware(AuthorizationMiddleware) {}

// handler

export const ConnectHandlersLive = HttpApiBuilder.group(
  Api,
  "connect",
  (handlers) =>
    handlers.handle(
      "market",
      Effect.fn("/connect/market")(function* ({ payload }) {
        // how do I set a cookie here ?
      })
    )
);
Was this page helpful?