A focused Docker Compose management web application.
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat: add state

Brooke 23cc08e4 ecbc982b

+19 -2
+3 -1
packages/node/src/api/mod.rs
··· 1 1 use axum::Router; 2 2 3 - pub fn router() -> Router { 3 + use crate::state::LuminaryState; 4 + 5 + pub fn router() -> Router<LuminaryState> { 4 6 Router::new().route("/ping", axum::routing::get(|| async { "pong" })) 5 7 }
+8 -1
packages/node/src/main.rs
··· 2 2 use color_eyre::eyre::Result; 3 3 use tokio::net::TcpListener; 4 4 5 + use crate::state::LuminaryState; 6 + 5 7 mod api; 6 8 mod docker; 9 + mod state; 7 10 8 11 #[tokio::main] 9 12 async fn main() -> Result<()> { 10 13 let listener = TcpListener::bind("0.0.0.0:9000").await?; 14 + let router = Router::<LuminaryState>::new() 15 + .nest("/api/", api::router()) 16 + .with_state(LuminaryState::new()); 17 + 11 18 println!("Listening on http://127.0.0.1:{}", listener.local_addr()?.port()); 12 - axum::serve(listener, Router::new().nest("/api/", api::router())).await?; 19 + axum::serve(listener, router).await?; 13 20 return Ok(()); 14 21 }
+8
packages/node/src/state.rs
··· 1 + #[derive(Clone, Debug)] 2 + pub struct LuminaryState {} 3 + 4 + impl LuminaryState { 5 + pub fn new() -> Self { 6 + Self {} 7 + } 8 + }