Router class

Routes a request to the first route whose method and pattern match it.

Each registration takes maxBodyBytes, the largest body that route reads when it needs more (or less) than the server's own limit. The native side reads a body before any Dart runs, so it has to be told: serve() takes bodyLimits as routeBodyLimits.

Constructors

Router()

Properties

bodyLimits → List<DVRouteBodyLimit>
Every route, in the order requests are dispatched to them, with the limit it declared or null for the server's.
no setter
hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

any(String pattern, Handler h, {int? maxBodyBytes}) → Router
call(Request req) → Future<Response>
delete(String pattern, Handler h, {int? maxBodyBytes}) → Router
get(String pattern, Handler h, {int? maxBodyBytes}) → Router
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
post(String pattern, Handler h, {int? maxBodyBytes}) → Router
put(String pattern, Handler h, {int? maxBodyBytes}) → Router
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Properties

accessLogsPerSecond ↔ int
Access records written one per request in any one second; the rest of that second is one summary line with their count. Answers of 500 and above, and failures, are always written one each, and the request metrics count every request whatever this is. Zero writes no individual access lines below 500. DARTVEL_ACCESS_LOGS_PER_SECOND sets it for a server.
getter/setter pair

Static Methods

measure(Request req, Future<Response> serve()) → Future<Response>
Runs serve for req and records the request once, with the status serve answered: the count in http_requests_total, the duration and the access record.

Constants

defaultAccessLogsPerSecond → const int
accessLogsPerSecond unless the process says otherwise.