2019-02-23 13:47:59 +00:00
|
|
|
# HTTP resource pack server
|
|
|
|
|
|
|
|
A common scenario is that you have a set of static resources that you want to
|
2019-03-05 18:41:02 +00:00
|
|
|
serve up quickly via HTTP (for example: stylesheets, WASM).
|
2019-02-23 13:47:59 +00:00
|
|
|
|
|
|
|
This package provides a `net/http`-compatible `http.Handler` to do so, with
|
|
|
|
support for:
|
|
|
|
- compression
|
|
|
|
- gzip
|
|
|
|
- brotli, if you have the external compression binary available at pack time
|
|
|
|
- does not yet support Transfer-Encoding, only Accept-Encoding/Content-Encoding
|
|
|
|
- etags
|
2019-04-12 09:16:23 +01:00
|
|
|
- ranges (TODO)
|
2019-02-23 13:47:59 +00:00
|
|
|
|
|
|
|
The workflow is as follows:
|
2019-03-08 09:16:25 +00:00
|
|
|
- (optional) build YAML file describing files to serve
|
2019-02-23 13:47:59 +00:00
|
|
|
- run htpacker tool to produce a single .htpack file
|
|
|
|
- create `htpack.Handler` pointing at .htpack file
|
|
|
|
|
2019-03-08 09:16:25 +00:00
|
|
|
The handler can easily be combined with middleware (`http.StripPrefix` etc.).
|