mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-04-24 22:59:58 -07:00
45 lines
1.0 KiB
Markdown
45 lines
1.0 KiB
Markdown
# brk_website
|
|
|
|
Website serving for BRK with minimal dependencies.
|
|
|
|
## Features
|
|
|
|
- **Embedded assets**: Website files compiled into binary
|
|
- **Filesystem mode**: Serve from custom path for development
|
|
- **SPA support**: Routes without extensions fallback to index.html
|
|
- **ImportMap**: Auto-generates import maps for hashed assets
|
|
|
|
## Usage
|
|
|
|
```rust,ignore
|
|
use brk_website::{Website, router};
|
|
|
|
// Create router for website
|
|
let website_router = router(Website::Default);
|
|
|
|
// Merge with your app
|
|
let app = your_api_router.merge(website_router);
|
|
```
|
|
|
|
## Website Enum
|
|
|
|
| Variant | Description |
|
|
|---------|-------------|
|
|
| `Default` | Filesystem in debug, embedded in release |
|
|
| `Filesystem(path)` | Always serve from specified path |
|
|
| `Disabled` | No routes registered |
|
|
|
|
## Standalone Server
|
|
|
|
See the `website` example for a complete standalone server with compression, tracing, and other middleware.
|
|
|
|
```sh
|
|
cargo run -p brk_website --example website
|
|
```
|
|
|
|
## Dependencies
|
|
|
|
- `axum` - HTTP routing
|
|
- `include_dir` - embedded assets
|
|
- `importmap` - asset hashing
|