How dart-lang/shelf works
Shelf is a Dart toolkit for creating and composing web servers around request-to-response handlers, with middleware as its central composition model. Its packages add routing, static and package-directory serving, proxying, WebSockets, test interactions, and HTTP compliance coverage; the router generator produces routers from source annotations. No source excerpts were provided, so relationships below are limited to capabilities and dependencies explicitly described in the README.
Main entry points: handler.dart Shelf handlers · pipeline.dart Middleware composition · router.dart Request router · shelf_router_generator.dart Router generator
Components 14
Shelf core
- Shelf handlers
pkgs/shelf/lib/src/handler.dart - Middleware composition
pkgs/shelf/lib/src/pipeline.dart - Request and response
pkgs/shelf/lib/src/message.dart
Routing
- Request router
pkgs/shelf_router/lib/src/router.dart - Route matching
pkgs/shelf_router/lib/src/route.dart - Router generator
pkgs/shelf_router_generator/lib/src/shelf_router_generator.dart
Server handlers
- Packages directory
pkgs/shelf_packages_handler/lib/src/dir_handler.dart - HTTP proxy
pkgs/shelf_proxy/lib/shelf_proxy.dart - Static files
pkgs/shelf_static/lib/src/static_handler.dart - Directory listing
pkgs/shelf_static/lib/src/directory_listing.dart - WebSocket handler
pkgs/shelf_web_socket/lib/src/web_socket_handler.dart
Testing and compliance
- HTTP test handler
pkgs/shelf_test_handler/lib/src/handler.dart - HTTP compliance
pkgs/_shelf_compliance/lib/src/compliance_harness.dart
Other components
- Application developer
Connections 12
- Application developer → Shelf handlers: creates servers
README.md - Application developer → Middleware composition: composes middleware
README.md - Shelf handlers → Request and response: handles requests
README.md - Middleware composition → Shelf handlers: composes handlers
README.md - Request router → Shelf handlers: routes requests
README.md - Router generator → Request router: generates routers
README.md - Packages directory → Shelf handlers: provides handler
README.md - HTTP proxy → Shelf handlers: provides handler
README.md - Static files → Shelf handlers: serves files
README.md - WebSocket handler → Shelf handlers: provides handler
README.md - HTTP test handler → Shelf handlers: tests interactions
README.md - HTTP compliance → Shelf handlers: checks compliance
README.md