You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+3Lines changed: 3 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -206,11 +206,14 @@ Bun.serve({
206
206
207
207
0http-bun includes a comprehensive middleware system with built-in middlewares for common use cases:
208
208
209
+
> 📦 **Note**: Starting with v1.2.2, some middleware dependencies are optional. Install only what you need: `jose` (JWT), `pino` (Logger), `prom-client` (Prometheus).
210
+
209
211
-**[Body Parser](./lib/middleware/README.md#body-parser)** - Automatic request body parsing (JSON, form data, text)
210
212
-**[CORS](./lib/middleware/README.md#cors)** - Cross-Origin Resource Sharing with flexible configuration
211
213
-**[JWT Authentication](./lib/middleware/README.md#jwt-authentication)** - JSON Web Token authentication and authorization
212
214
-**[Logger](./lib/middleware/README.md#logger)** - Request logging with multiple output formats
213
215
-**[Rate Limiting](./lib/middleware/README.md#rate-limiting)** - Flexible rate limiting with sliding window support
216
+
-**[Prometheus Metrics](./lib/middleware/README.md#prometheus-metrics)** - Export metrics for monitoring and alerting
Copy file name to clipboardExpand all lines: lib/middleware/README.md
+57Lines changed: 57 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,30 @@
2
2
3
3
0http-bun provides a comprehensive middleware system with built-in middlewares for common use cases. All middleware functions are TypeScript-ready and follow the standard middleware pattern.
4
4
5
+
## Dependency Installation
6
+
7
+
⚠️ **Important**: Starting with v1.2.2, middleware dependencies are now **optional** and must be installed separately when needed. This reduces the framework's footprint and improves startup performance through lazy loading.
8
+
9
+
Install only the dependencies you need:
10
+
11
+
```bash
12
+
# For JWT Authentication middleware
13
+
npm install jose
14
+
15
+
# For Logger middleware
16
+
npm install pino
17
+
18
+
# For Prometheus Metrics middleware
19
+
npm install prom-client
20
+
```
21
+
22
+
**Benefits of Lazy Loading:**
23
+
24
+
- 📦 **Smaller Bundle**: Only install what you use
25
+
- ⚡ **Faster Startup**: Dependencies loaded only when middleware is used
0 commit comments