Iskra API Reference
    Preparing search index...

    Function describeRoute

    • Middleware that documents the routes it is on in OpenAPIFeature's /openapi.json; at runtime it only calls next(). On a route it describes that route; on a group (or an app.use() path) every route under it, whose own describeRoute() adds tags and overrides the rest.

      const users = api.group('/users', describeRoute({ tags: ['Users'] }), requireActor(auth));
      users.get('/:id', describeRoute({ summary: 'A user', ok: User }), getUser);
      users.post('/', describeRoute({ summary: 'Create a user', responses: { 201: { schema: User } } }), validate({ body: NewUser }), createUser);

      validate() declares the route's params, query and body, the gates of requireActor() its security (and a 401), requireScopes() a 403.

      Parameters

      Returns MiddlewareHandler