Expand description
DbrestApp — fluent builder for constructing a dbrest router.
This is the primary API for using dbrest-core as a library. It lets
consumers create an axum::Router that can be nested, merged, or
served standalone — instead of handing over the entire server lifecycle.
§Single datasource
use std::sync::Arc;
use dbrest_core::app::builder::DbrestApp;
use dbrest_core::config::AppConfig;
// Assume `MyBackend` and `MyDialect` implement the required traits.§Multi-datasource (future)
Register multiple backends keyed by a profile name. The incoming
Accept-Profile / Content-Profile header selects which datasource
handles the request.
ⓘ
let app = DbrestApp::new()
.datasource("pg", pg_backend, PgDialect, pg_config)
.datasource("sqlite", sqlite_backend, SqliteDialect, sqlite_config)
.build()
.await?;Structs§
- Datasource
- A single database datasource with its backend, dialect, config, and version.
- Dbrest
App - Fluent builder for constructing a dbrest
axum::Router. - Dbrest
Routers - Output of
DbrestApp::build.