registerRoute method

void registerRoute(
  1. String method,
  2. String route,
  3. Schema? schema,
  4. FutureOr<Response> action(
    1. Request req
    ),
)

Registers a route in HTTP endpoint.

  • method HTTP method: 'get', 'head', 'post', 'put', 'delete'
  • route a command route. Base route will be added to this route
  • schema a validation schema to validate received parameters.
  • action an action function that is called when operation is invoked.

Implementation

void registerRoute(String method, String route, Schema? schema,
    FutureOr<Response> Function(Request req) action) {
  if (endpoint == null) return;
  route = _appendBaseRoute(route);
  endpoint!.registerRoute(method, route, schema, action);
}