mirror of
https://github.com/oven-sh/bun
synced 2026-02-02 15:08:46 +00:00
## Summary - Add comprehensive documentation distinguishing static routes from file routes in `Bun.serve()` - Document caching behavior differences: ETag vs Last-Modified - Explain performance characteristics and error handling differences - Provide clear use case recommendations ## Changes - **File Responses vs Static Responses** section explaining the two approaches - **HTTP Caching Behavior** section detailing ETag and Last-Modified support - **Status Code Handling** section covering automatic 204/304 responses - Code examples showing both patterns with clear explanations ## Key Documentation Points - Static routes (`new Response(await file.bytes())`) buffer content in memory at startup - File routes (`new Response(Bun.file(path))`) read from filesystem per request - Static routes use ETags for caching, file routes use Last-Modified headers - File routes handle 404s automatically, static routes cause startup errors for missing files - Both support HTTP caching standards but with different validation strategies 🤖 Generated with [Claude Code](https://claude.ai/code) --------- Co-authored-by: Claude Bot <claude-bot@bun.sh> Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>