From ccdcc1891b01b43069991cf58a588145b7559090 Mon Sep 17 00:00:00 2001 From: Cara Salter Date: Fri, 27 May 2022 23:35:22 -0400 Subject: 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 --- src/main.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/main.rs') 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::() { -- cgit v1.2.3