Closed thekid closed 3 years ago
This handler could make use of the new async functionality released in https://github.com/xp-forge/web/releases/tag/v2.8.0
This handler could make use of the new async functionality
...but would break compatibility with our current version constraint "xp-forge/web": "^2.0 | ^1.0"
, so saving this for the next major release. Plan would be the following:
two
branch to be able to easily release possible bug fix releasestransfer(...)
to yield from transmit(...)
inside the handler, adjust version constraint to ^2.8
and release as 3.0.0
Basically the same as
web.handlers.FilesFrom
(and can serve as a snap-in replacement as seen below), but with support for compressed files (Accept-Encoding: gzip
will also check for[file].gz
).Usage
Here's an example of how to refactor your app:
Compressing files
The handler will not do this on the fly, because you most probably know what you're able to compress and what not during build time. Our starting point:
To compress them, use the following (by using
-k
, we keep the original files, which we'll deliver to all user agents that do not support compression!):The savings are noticeable:
Caching
Same API as with
FilesFrom
seen in xp-forge/web#74 (though not dependant on this pull request being merged!)See also xp-forge/web#71
Outcome
Before:
After:
See also https://github.com/xp-forge/frontend/pull/12#issuecomment-808738164