diff options
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/main.rs b/src/main.rs index 43957ff..a8acc5f 100644 --- a/src/main.rs +++ b/src/main.rs | |||
@@ -37,7 +37,8 @@ mod wol; | |||
37 | #[derive(OpenApi)] | 37 | #[derive(OpenApi)] |
38 | #[openapi( | 38 | #[openapi( |
39 | paths( | 39 | paths( |
40 | start::start, | 40 | start::post, |
41 | start::get, | ||
41 | start::start_payload, | 42 | start::start_payload, |
42 | device::get, | 43 | device::get, |
43 | device::get_payload, | 44 | device::get_payload, |
@@ -119,13 +120,14 @@ async fn main() -> color_eyre::eyre::Result<()> { | |||
119 | 120 | ||
120 | let app = Router::new() | 121 | let app = Router::new() |
121 | .route("/start", post(start::start_payload)) | 122 | .route("/start", post(start::start_payload)) |
122 | .route("/start/:id", post(start::start)) | 123 | .route("/start/:id", post(start::post).get(start::get)) |
123 | .route( | 124 | .route( |
124 | "/device", | 125 | "/device", |
125 | post(device::post).get(device::get_payload).put(device::put), | 126 | post(device::post).get(device::get_payload).put(device::put), |
126 | ) | 127 | ) |
127 | .route("/device/:id", get(device::get)) | 128 | .route("/device/:id", get(device::get)) |
128 | .route("/status", get(status::status)) | 129 | .route("/status", get(status::status)) |
130 | // TODO: Don't load on `None` Auth | ||
129 | .route_layer(from_fn_with_state(shared_state.clone(), auth::auth)) | 131 | .route_layer(from_fn_with_state(shared_state.clone(), auth::auth)) |
130 | .merge(SwaggerUi::new("/swagger-ui").url("/api-docs/openapi.json", ApiDoc::openapi())) | 132 | .merge(SwaggerUi::new("/swagger-ui").url("/api-docs/openapi.json", ApiDoc::openapi())) |
131 | .with_state(Arc::new(shared_state)); | 133 | .with_state(Arc::new(shared_state)); |