diff --git a/server/src/main.rs b/server/src/main.rs index c38bd05..ab3407b 100644 --- a/server/src/main.rs +++ b/server/src/main.rs @@ -45,20 +45,14 @@ async fn route_dispatcher(pool: &Pool, resp: &mut Response, meth: &Method, // At some point we should have some way of hiding this obnoxious complexity use routes::resolve_dynamic_route; match (meth, path) { - (&Method::GET, routes::INVITE_JOIN) => { - if let Err(_) = invites::route_join_invite_code(pool, resp, params).await { - *resp.status_mut() = StatusCode::INTERNAL_SERVER_ERROR; - } - }, - (&Method::GET, routes::INVITE_CREATE) => { - if let Err(_) = invites::create_invite(pool, resp).await { - *resp.status_mut() = StatusCode::INTERNAL_SERVER_ERROR; - } - }, + /* INVITES */ + (&Method::GET, routes::INVITE_JOIN) => invites::route_join_invite_code(pool, resp, params).await, + (&Method::GET, routes::INVITE_CREATE) => { invites::create(pool, resp).await, + /* CHANNELS */ (&Method::GET, routes::CHANNELS_LIST) => channels::list_channels(pool, resp).await, (&Method::POST, routes::CHANNELS_CREATE) => channels::create_channel(pool, resp, params).await, (&Method::POST, routes::CHANNELS_DELETE) => channels::delete_channel(pool, resp, params).await, - + /* MESSAGING */ (&Method::POST, routes::MESSAGE_SEND) => messages::send_message(pool, resp, params).await, _ => { // We attempt dynamic routes as fallback for a few reasons