diff options
author | Cara Salter <cara@devcara.com> | 2022-05-27 23:35:22 -0400 |
---|---|---|
committer | Cara Salter <cara@devcara.com> | 2022-05-27 23:35:22 -0400 |
commit | ccdcc1891b01b43069991cf58a588145b7559090 (patch) | |
tree | 347040d20aff34f3482b50aca26e6b9a1fb438fa /src/main.rs | |
parent | 372b484e8a6366346d52ff44bbdaa6aad1cc2daa (diff) | |
download | homeworld-ccdcc1891b01b43069991cf58a588145b7559090.tar.gz homeworld-ccdcc1891b01b43069991cf58a588145b7559090.zip |
meta: API Scaffold
Initial implementation of a CRUD API for Ships. Should probably at some
point support getting specific Ships based on something like shasum or
an ID, so that solard can more easily pull it down
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/main.rs b/src/main.rs index ba319d9..31271e4 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2,7 +2,7 @@ use axum::{ error_handling::HandleErrorLayer, http::StatusCode, response::IntoResponse, - routing::get, + routing::{get, post, delete}, Json, Router }; @@ -32,7 +32,10 @@ async fn main() { let app = Router::new() .route("/health", get(health_check)) - .route("/waifus/list", get(handlers::waifus::list)) + .route("/ships/list", get(handlers::ships::list)) + .route("/ships/new", post(handlers::ships::new)) + .route("/ships/update", post(handlers::ships::update)) + .route("/ships/delete/:shasum", delete(handlers::ships::delete)) .layer( ServiceBuilder::new() .layer(HandleErrorLayer::new(|error: BoxError| async move { if error.is::<tower::timeout::error::Elapsed>() { |