diff options
author | FxQnLr <[email protected]> | 2024-04-08 15:44:31 +0200 |
---|---|---|
committer | FxQnLr <[email protected]> | 2024-04-08 15:44:31 +0200 |
commit | a91a2ca5c88403e905bf0f798393587fc4d900fa (patch) | |
tree | 12b141ac2a50ec02e87c8d02ba06d7bec3f4c0e4 /src/main.rs | |
parent | 52851787329c48c1e70f98a3610ad52fe1fa4aa4 (diff) | |
download | webol-a91a2ca5c88403e905bf0f798393587fc4d900fa.tar webol-a91a2ca5c88403e905bf0f798393587fc4d900fa.tar.gz webol-a91a2ca5c88403e905bf0f798393587fc4d900fa.zip |
Closes #26. Addtional GET request for /start
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)); |