with-interceptor
fandhe-backend のコア拡張点 Interceptor(リダイレクト・レスポンス改変) だけを見せる最小サンプルです。独立して cargo run できる standalone crate として examples/with-interceptor/ に切り出されています。
何を見せるサンプルか
TrailingSlashRedirect(Interceptor::interceptのみ実装): 末尾スラッシュ 付きパスを 301 でLocationへリダイレクトする(?queryがあれば保存する)SecurityHeaders(Interceptor::map_responseのみ実装): 全応答へX-Content-Type-Options: nosniff/X-Frame-Options: DENYを付与する (intercept応答・Handlerのフォールバック応答(404 等)の両方に及ぶ)Interceptorが feature ゲート不要の純コア拡張点であること (外部依存ゼロ、pay-for-what-you-use)
Interceptor 以外の feature(cors / compression / static / openapi 等)は焦点外 のため有効化していません(複数 feature を組み合わせた実運用形の雛形は templates/app を参照してください)。
起動方法
cd examples/with-interceptor
cargo run既定で 127.0.0.1:3000 に bind します(PORT 環境変数で上書き可能)。
検証 curl 例
# 通常応答(200 + セキュリティヘッダを確認)
curl -si http://127.0.0.1:3000/hello
# 末尾スラッシュの正規化(301 + Location: /hello を確認)
curl -si http://127.0.0.1:3000/hello/GitHub 上の実体
コード全文・詳細な README は examples/with-interceptor/ を参照してください。