Repository navigation
v0.1.46
release: aurora 0.1.46
Serve the assets ahead of the application, not as routes
A page ships unbundled, so one load is dozens of .js requests — ninety-six
on a real application. Mounted as routes on the host router, each one traversed
the whole middleware stack, and an application that resolves a user from a
session cookie therefore ran SELECT * FROM users ninety-six times for bytes
that are identical for every visitor.
Every application otherwise had to write the exemption itself, in its own
kernel, for a cost the framework created. Most never would, and nothing would
tell them.
So the provider resolves 'server' instead of 'router' and installs one
middleware covering every mount — the tier @adonisjs/static registers on, and
never as a route. Providers start before the preloads, which is what puts it
ahead of the application's own server.use([...]).
Only GET and HEAD are claimed; the longest prefix wins, so /__assets/comet/dist
beats a mount at /__assets/comet whatever order they were built in.
Changes since v0.1.45.