Iskra API Reference
    Preparing search index...

    Function defineRoute

    • Declares a route with the body and query types inferred from its schema (inside a plain routes: [...] list they would be unknown):

      defineRoute({
      method: "POST",
      path: "/users",
      schema: { body: z.object({ name: z.string() }) },
      handler: (ctx) => ({ created: ctx.body.name }), // string
      });

      Type Parameters

      • B = unknown
      • Q = unknown

      Parameters

      Returns RouteOptions<B, Q>