send the errors of the route added last to renderer, not to the
ExceptionHandler.render of AppConfig. It covers the errors of the
middleware too, and a body that fails to read (eg. a broken multipart body). A
request with a _method override is not covered for a body error,
because its route is not known yet. For a body that failed to read, the
renderer gets a request with an empty body. The error is still
reported when it is a 5xx or not an HTTP error. A 4xx error (like
400 or 413) is not reported, as everywhere in Dox.
Return null to let Dox render it as usual. Use it when the route
answers in its own format, like gRPC.
only match the route added last when its param matches regex.
Else the route does not match, and the next route is tried (or the
client gets 404). The regex must match the whole param text. Use
(?:...) for groups, not (...). The value is checked again after
% decoding, so the decoded text must match too (a %20 is a space
then).
do not run the middleware of type T on the route added last. It
takes out every middleware of type T or a subtype of T on that
route. That includes global, router and group middleware, the
middleware in the route's own list, and a .timeout() added before.
The controller stays. T is required: with no type argument (or
Object or dynamic) it would drop everything, auth and CSRF too,
so it throws an ArgumentError. So withoutMiddleware<IDoxNextMiddleware>()
takes out every next-style middleware. Use it for a route that a
global middleware does not fit, like a long stream and
RequestTimeout. The OpenAPI docs of the route follow it.
turn the route param param into a value before the controller
runs. resolve gets the raw text and gives the value, or null
when there is none: then the request gets 404.
read it with req.bound<T>(param), or add a controller parameter
of type T. call it before the server starts.
the route for a GET or HEAD request that matches no other route and
no staticFiles file. Use it for a custom 404 page, or to send
index.html of a single page app. Other methods still get 404 or 405.
send every request under prefix straight to handler, before
routing and body reading. the handler writes and closes the
response itself. Socket.IO uses this for /socket.io/.
url with a signature query param, so the link can not be
changed. Check it with the ValidateSignature middleware. With
expires, the url also has an expires param (unix seconds) and
stops working after that time.
serve the files in folder under prefix, for GET and HEAD
requests that match no route. Routes always win, so a normal
request does not touch the disk. No middleware runs for a file.
Like other routes, prefix follows group, the router prefix and
domain. folder is relative to the folder the app starts in.
Never save user uploads in folder: an uploaded html or svg file
would run its script on your site. Use dox_storage for them.
.., dot files (like .env) and folders are never sent: they get
404. Only a .well-known folder at the top of folder is sent.
A file gets ETag and Last-Modified (and 304 when the browser has it),
Range support, and Cache-Control: public, max-age=... with
maxAge. Give hashed build files (like Vite's) a long maxAge.
the path of the route named name, with its {params} filled in.
a param value is url encoded. query is added as the query string.
a param that is not in the path goes to the query string too. When
params and query have the same key, query wins. A null value
is left out. an unknown name or a missing param throws an
ArgumentError.
a route for the WebDAV VIEW HTTP method. It does not render a
template. To render a template, use a GET route:
Route.get('welcome', (DoxRequest req) => view(req, 'welcome'))
with view() of dox_view.
raw WebSocket route. handler gets the open socket.
Middleware runs first, so it can check auth.
For rooms, acks and the socket.io clients, use dox_socketio.