@@ -8,7 +8,11 @@ features.
88- ** Very fast** performance of C on the web.
99- ** Templates are precompiled** all errors are visible at compilation time, not at runtime.
1010- ** Middleware** functionality similar to other big frameworks.
11+ - ** HTTPS support** directly from ` veb ` via ` mbedtls ` .
12+ - ** Method-aware route middleware** for protecting only selected HTTP verbs.
13+ - ** Static compression** with gzip/zstd, including manual pre-compression support.
1114- ** Controllers** to split up your apps logic.
15+ - ** Graceful shutdown** support in the ` new_veb ` backend.
1216- ** Easy to deploy** just one binary file that also includes all templates. No need to install any
1317 dependencies.
1418
@@ -119,6 +123,18 @@ fn main() {
119123}
120124```
121125
126+ ## Graceful shutdown
127+
128+ When running with ` -d new_veb ` , the underlying server supports graceful
129+ shutdown. Once shutdown begins, it stops accepting new requests, waits for
130+ in-flight requests to finish, and only then exits. This is useful for deploys,
131+ tests, and management endpoints that trigger a stop after sending a response.
132+
133+ The lifecycle controls come from the underlying ` fasthttp.ServerHandle `
134+ (` wait_till_running() ` and ` shutdown(timeout: ...) ` ). If you need explicit
135+ server lifecycle management, use those lower-level hooks in the process that
136+ starts your app.
137+
122138## Defining endpoints
123139
124140To add endpoints to your web server, you must extend the ` App ` struct.
@@ -469,8 +485,8 @@ over gzip when the client supports both.
4694851 . ** Manual pre-compression** : If you create ` .zst ` or ` .gz ` files manually, veb will serve
470486 them in zero-copy streaming mode for maximum performance when the MIME type is allowed.
4714872 . ** Lazy compression cache** : Files smaller than the threshold are automatically compressed
472- on first request and cached as ` .zst ` or ` .gz ` files on disk (zstd preferred when client
473- supports it).
488+ on first request and cached under ` os.cache_dir()/veb/static_compression/ `
489+ (zstd preferred when the client supports it). The source directory stays unchanged .
4744903 . ** Cache validation** : If the original file is modified, the compressed cache is
475491 automatically regenerated on the next request.
4764924 . ** Streaming for large files** : Files larger than the threshold are served uncompressed in
@@ -561,8 +577,8 @@ curl -H "Accept-Encoding: zstd, gzip" --compressed http://localhost:8080/app.js
561577# Request without encoding - should return uncompressed content
562578curl -i http://localhost:8080/app.js
563579
564- # Verify that compressed cache file was created
565- ls -lh static/app.js.zst static/app.js.gz 2> /dev/null
580+ # Auto-generated cache files are stored under:
581+ # os.cache_dir()/veb/static_compression/
566582
567583# Test manual pre-compression - style.css.zst is served directly (zero-copy)
568584curl -H " Accept-Encoding: zstd" -i http://localhost:8080/style.css
@@ -579,6 +595,8 @@ serve `.zst` if the client supports zstd, otherwise `.gz` if gzip is supported.
579595
580596- The lazy cache is created on first request, so the first visitor pays a small
581597 compression cost, but all subsequent requests are served at zero-copy speed.
598+ - Auto-generated cache files live in the OS cache directory, so read-only static
599+ folders still work and your source tree stays clean.
582600- Large files (> threshold) are always streamed, ensuring low memory usage even for large assets.
583601- The ` encode_auto ` middleware automatically chooses zstd or gzip based on client support. You can
584602 also use ` encode_zstd ` or ` encode_gzip ` for specific compression.
@@ -1165,4 +1183,4 @@ fn main() {
11651183 mut app := &App{}
11661184 veb.run[App, Context](mut app, 8080)
11671185}
1168- ```
1186+ ```
0 commit comments