class

Analyzer::Dart::Shelf

Inherits Analyzer < FileHelper < Reference < Object

Shelf (package:shelf_router/shelf_router.dart) is the foundational Dart HTTP server library. The Router API exposes a method per verb (router.get, router.post, ...) and a mount('/prefix', subRouter) composition primitive. Handlers are typically wired with cascade operators on a fresh Router():

final router = Router() ..get('/users', _listUsers) ..post('/users', _createUser) ..get('/users/<id>', _getUser) ..mount('/api/v1', apiRouter.call);

Direct method calls (router.get('/foo', _handler)) and .all(...) — which registers a handler against every verb — are also supported. Path captures use angle brackets (<id>, <id|[0-9]+>) which we surface as {id} path params.

Mounts are resolved across files: a Router variable mounted under /prefix contributes its routes (recursively) under that prefix in the parent router. Each top-level router (not mounted anywhere) is emitted as a separate set of endpoints.

Constants

ALL_VERBS = ["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS"]
HTTP_METHOD_MAP = {"get" => "GET", "post" => "POST", "put" => "PUT", "patch" => "PATCH", "delete" => "DELETE", "head" => "HEAD", "options" => "OPTIONS"}
ROUTE_ANNOTATION_REGEX = /@Route\s*(?:\.\s*([A-Za-z]+))?\s*\(/

Matches the official @Route.<verb>('/path') annotation and the shelf_router_classes @Route('VERB', '/path') variant. Capture 1 is the dotted verb (nil for the string-arg form).

ROUTE_PREFIX_REGEX = /@RoutePrefix\s*\(/

Class methods

tech_name
Source

Instance methods

analyze
Source
tech

Instance-side view of the same declaration. The per-file rescues live on this base class, which has no way to name the analyzer that is running inside them, so a skipped file could not be attributed to a tech. Deriving it from analyzer_for keeps the name written exactly once.

Source

Nested types