Skip to content

Commit d1da29a

Browse files
committed
docs: update express-server.md
1 parent ff38d46 commit d1da29a

1 file changed

Lines changed: 55 additions & 39 deletions

File tree

docs/docs/express-server/express-server.md

Lines changed: 55 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -355,32 +355,32 @@ new ServerConfigBuilder()
355355
.withPort(port: number)
356356
.withHost(host: string)
357357
.enableCors()
358-
.withCors(options)
358+
.withCors(options: CorsOptions)
359359
.enableHelmet()
360-
.withHelmet(options)
360+
.withHelmet(options: HelmetOptions)
361361
.enableCompression()
362-
.withCompression(options)
363-
.enableRateLimit(options)
364-
.withRateLimit(options)
365-
.enableRequestLogging(options)
366-
.withRequestLogging(options)
367-
.enableMetrics(options)
368-
.withMetrics(options)
369-
.withHealthCheck(options)
370-
.enableOpenApi(filePath, options)
371-
.withOpenApi(options)
362+
.withCompression(options: CompressionOptions)
363+
.enableRateLimit(options: RateLimitOptions)
364+
.withRateLimit(options: RateLimitOptions)
365+
.enableRequestLogging(options: RequestLoggingOptions)
366+
.withRequestLogging(options: RequestLoggingOptions)
367+
.enableMetrics(options: MetricsOptions)
368+
.withMetrics(options: MetricsOptions)
369+
.withHealthCheck(options: HealthCheckOptions)
370+
.enableOpenApi(filePath: string, options: OpenApiOptions)
371+
.withOpenApi(options: OpenApiOptions)
372372
.withMicroService({ appName, serviceVersion })
373-
.withTrustProxy(value)
374-
.withRequestId(options)
375-
.enableResponseTime(options)
376-
.withResponseTime(options)
377-
.withBodyParser(options)
378-
.withCookies(options)
373+
.withTrustProxy(value: boolean)
374+
.withRequestId(options: { headerName?: string; exposeHeader?: boolean; generator?: () => string })
375+
.enableResponseTime(options: { addHeader?: boolean; logOnComplete?: boolean })
376+
.withResponseTime(options: { addHeader?: boolean; logOnComplete?: boolean })
377+
.withBodyParser(options: { json?: BodyParserOptions; urlencoded?: BodyParserOptions })
378+
.withCookies(options: { secret?: string; secure?: boolean })
379379
.withStaticFolder({ path, directory, ... })
380-
.withGlobalHeaders(headers)
381-
.withGlobalPrefix(prefix)
382-
.withHttps(options)
383-
.withCustom(overrides)
380+
.withGlobalHeaders(headers: Record<string, string>)
381+
.withGlobalPrefix(prefix: string)
382+
.withHttps(options: { cert: string; key: string; ca?: string })
383+
.withCustom(overrides: Partial<ServerConfig>)
384384
.build()
385385
```
386386

@@ -534,21 +534,37 @@ const registry = server.getMetricsRegistry();
534534
See [ServerConfigBuilder](#serverconfigbuilder) and [ExpressServer](#expressserver) for full method documentation and options.
535535

536536
---
537-
- `withCompression(opts)` / `enableCompression()` / `disableCompression()` - Configure response compression
538-
- `withRateLimit(opts)` / `enableRateLimit(opts)` / `disableRateLimit()` - Configure rate limiting
539-
- `withRequestLogging(opts)` / `enableRequestLogging(opts)` / `disableRequestLogging()` - Configure request logging
540-
- `withMetrics(opts)` / `enableMetrics(opts)` / `disableMetrics()` - Configure Prometheus metrics
541-
- `withHealthCheck(opts)` - Configure health check endpoints
542-
- `withOpenApi(opts)` / `enableOpenApi(filePath, opts)` / `disableOpenApi()` - Configure OpenAPI documentation
543-
- `withMicroService(opts)` - Configure as a microservice
544-
- `withTrustProxy(opts)` - Configure trust proxy settings
545-
- `withRequestId(opts)` - Configure request ID generation
546-
- `withResponseTime(opts)` / `enableResponseTime(opts)` / `disableResponseTime()` - Configure response time tracking
547-
- `withBodyParser(opts)` - Configure request body parsing
548-
- `withCookies(opts)` - Configure cookie parsing
549-
- `withStaticFolder(folder)` - Configure static file serving
550-
- `withGlobalHeaders(headers)` - Set global response headers
551-
- `withGlobalPrefix(prefix)` - Set global route prefix
552-
- `withHttps(opts)` - Configure HTTPS
553-
- `withCustom(overrides)` - Apply custom configuration
537+
- `withCompression(opts: CompressionOptions)` / `enableCompression()` / `disableCompression()` - Configure response compression
538+
- `withRateLimit(opts: RateLimitOptions)` / `enableRateLimit(opts: RateLimitOptions)` / `disableRateLimit()` - Configure rate limiting
539+
- `withRequestLogging(opts: RequestLoggingOptions)` / `enableRequestLogging(opts: RequestLoggingOptions)` / `disableRequestLogging()` - Configure request logging
540+
- `withMetrics(opts: MetricsOptions)` / `enableMetrics(opts: MetricsOptions)` / `disableMetrics()` - Configure Prometheus metrics
541+
- `withHealthCheck(opts: HealthCheckOptions)` - Configure health check endpoints
542+
- `withOpenApi(opts: OpenApiOptions)` / `enableOpenApi(filePath: string, opts: OpenApiOptions)` / `disableOpenApi()` - Configure OpenAPI documentation
543+
- `withMicroService(opts: MicroServiceOptions)` - Configure as a microservice
544+
- `withTrustProxy(opts: TrustProxyOptions)` - Configure trust proxy settings
545+
- `withRequestId(opts: RequestIdOptions)` - Configure request ID generation
546+
- `withResponseTime(opts: ResponseTimeOptions)` / `enableResponseTime(opts: ResponseTimeOptions)` / `disableResponseTime()` - Configure response time tracking
547+
- `withBodyParser(opts: BodyParserOptions)` - Configure request body parsing
548+
- `withCookies(opts: CookiesOptions)` - Configure cookie parsing
549+
- `withStaticFolder(folder: string)` - Configure static file serving
550+
- `withGlobalHeaders(headers: Record<string, string>)` - Set global response headers
551+
- `withGlobalPrefix(prefix: string)` - Set global route prefix
552+
- `withHttps(opts: HttpsOptions)` - Configure HTTPS
553+
- `withCustom(overrides: Partial<ServerConfig>)` - Apply custom configuration
554554
- `build()` - Build the final configuration
555+
556+
---
557+
558+
## Required npm Packages for Features
559+
560+
| Feature | Required npm Packages |
561+
|------------------------|-----------------------------------------|
562+
| CORS | `cors` |
563+
| Helmet (security) | `helmet` |
564+
| Compression | `compression` |
565+
| Cookie Parsing | `cookie-parser` |
566+
| Rate Limiting | `express-rate-limit` |
567+
| Prometheus Metrics | `prom-client` |
568+
| OpenAPI Docs | `@scalar/express-api-reference` |
569+
570+
**Note:** These packages must be installed via `npm install <package>` if you enable the corresponding feature in your server config.

0 commit comments

Comments
 (0)