update examples
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
# axum-app-wrapper
|
# axum-app-wrapper
|
||||||
|
|
||||||
A small plugin layer for `axum` applications, inspired by [fastify](https://fastify.dev/) from the Node/JS ecosystem.
|
A small plugin layer for `axum` applications, inspired by [fastify](https://fastify.dev/) from the Node/JS ecosystem and the [rocket](https://rocket.rs/) framework.
|
||||||
|
|
||||||
Plugins can:
|
Plugins can:
|
||||||
|
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ async fn main() -> anyhow::Result<()> {
|
|||||||
let metrics_registry = Arc::new(Metrics::new());
|
let metrics_registry = Arc::new(Metrics::new());
|
||||||
|
|
||||||
// Create your plugins using AdHocPlugin
|
// Create your plugins using AdHocPlugin
|
||||||
let config_plugin = AdHocPlugin::<AppState>::new()
|
let config_plugin = AdHocPlugin::<AppState>::named("Config")
|
||||||
.on_init(async |mut state| {
|
.on_init(async |mut state| {
|
||||||
state.insert(config);
|
state.insert(config);
|
||||||
Ok(state)
|
Ok(state)
|
||||||
@@ -53,7 +53,7 @@ async fn main() -> anyhow::Result<()> {
|
|||||||
Ok(router.route("/health", get(health)))
|
Ok(router.route("/health", get(health)))
|
||||||
});
|
});
|
||||||
|
|
||||||
let metrics_plugin = AdHocPlugin::<AppState>::new()
|
let metrics_plugin = AdHocPlugin::<AppState>::named("Metrics")
|
||||||
.on_init(async |mut state| {
|
.on_init(async |mut state| {
|
||||||
state.insert(metrics_registry);
|
state.insert(metrics_registry);
|
||||||
Ok(state)
|
Ok(state)
|
||||||
|
|||||||
Reference in New Issue
Block a user