Configuration
Customize the server with WebServiceConfigBuilder and pass the built WebServerConfig to LuxisBuilder.withConfig(...):
Luxis.app(MyApp::registerRoutes) .withConfig(new WebServiceConfigBuilder() .setPort(8080) .setDefaultBlockingTimeoutMillis(5000) .setExceptionHandler(Throwable::printStackTrace) .setMaxBodySize(1_048_576) .build()) .start();Available Options
Section titled “Available Options”| Method | Description | Default |
|---|---|---|
setPort(int) | The port the server listens on | 8080 |
setDefaultBlockingTimeoutMillis(int) | Timeout for blocking pipeline steps | 30000 |
setExceptionHandler(Consumer<Exception>) | Handler for uncaught exceptions | no-op |
setMaxBodySize(long) | Maximum request body size in bytes | unlimited |
setCorsConfig(CorsConfig) | CORS policy configuration | none |
CORS Configuration
Section titled “CORS Configuration”Use CorsConfigBuilder to configure CORS. The builder also exposes allowMethod, allowHeader, exposeHeader, allowCredentials, and maxAgeSeconds:
new WebServiceConfigBuilder() .setCorsConfig(new CorsConfigBuilder() .allowOrigin("https://example.com") .allowMethod("GET") .allowMethod("POST") .allowHeader("Authorization") .allowCredentials(true) .build()) .build();