Skip to content

Type Alias: RineMiddleware

type RineMiddleware = (ctx, next) => Promise<Response>;

Defined in: rine-ts-sdk/src/api/middleware.ts:135

Functional middleware — Koa/Hono/Vercel-AI-SDK shape.

  • Continue: call next() and return (or return-from) its Response.
  • Short-circuit: do not call next(). The downstream chain and the network request are both skipped. Middleware can synthesize a Response to serve a cached/mocked reply.
  • Throw: propagates up the chain as a rejected promise.

Parameters

Parameter Type
ctx RequestContext
next () => Promise\<Response>

Returns

Promise\<Response>