refactor
This commit is contained in:
parent
b3d8d408d2
commit
e620db1385
|
|
@ -0,0 +1,35 @@
|
||||||
|
use axum::{
|
||||||
|
Router,
|
||||||
|
routing::{get, post}
|
||||||
|
};
|
||||||
|
|
||||||
|
pub fn router() -> Router {
|
||||||
|
Router::new()
|
||||||
|
.nest("/:user_id", user_router())
|
||||||
|
.route("/",
|
||||||
|
post(post_sign_up)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn user_router() -> Router {
|
||||||
|
Router::new()
|
||||||
|
.route("/sign-in",
|
||||||
|
get(get_sign_in)
|
||||||
|
.post(post_sign_in)
|
||||||
|
)
|
||||||
|
.route("/backup",
|
||||||
|
post(post_backup)
|
||||||
|
)
|
||||||
|
.route("/restore",
|
||||||
|
get(get_restore)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub async fn get_sign_in() {}
|
||||||
|
pub async fn post_sign_in() {}
|
||||||
|
|
||||||
|
pub async fn post_sign_up() {}
|
||||||
|
|
||||||
|
pub async fn post_backup() {}
|
||||||
|
|
||||||
|
pub async fn get_restore() {}
|
||||||
32
src/api.rs
32
src/api.rs
|
|
@ -1,32 +0,0 @@
|
||||||
use axum::{
|
|
||||||
Router,
|
|
||||||
routing::{get, post}
|
|
||||||
};
|
|
||||||
|
|
||||||
mod account;
|
|
||||||
mod model;
|
|
||||||
|
|
||||||
pub fn api_router() -> Router {
|
|
||||||
Router::new()
|
|
||||||
.nest("/account/:user_id", account_router())
|
|
||||||
.route("/account",
|
|
||||||
post(account::post_sign_up)
|
|
||||||
)
|
|
||||||
.route("/predict",
|
|
||||||
get(model::get_predict)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn account_router() -> Router {
|
|
||||||
Router::new()
|
|
||||||
.route("/sign-in",
|
|
||||||
get(account::get_sign_in)
|
|
||||||
.post(account::post_sign_in)
|
|
||||||
)
|
|
||||||
.route("/backup",
|
|
||||||
post(account::post_backup)
|
|
||||||
)
|
|
||||||
.route("/restore",
|
|
||||||
get(account::get_restore)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
pub async fn get_sign_in() {}
|
|
||||||
pub async fn post_sign_in() {}
|
|
||||||
|
|
||||||
pub async fn post_sign_up() {}
|
|
||||||
|
|
||||||
pub async fn post_backup() {}
|
|
||||||
|
|
||||||
pub async fn get_restore() {}
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
pub async fn get_predict() {}
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
//TODO: New User Auth loop
|
|
||||||
//TODO: Existing User Auth loop
|
|
||||||
//TODO: Hash Function
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
//TODO: Logic for backing up an account
|
|
||||||
11
src/lib.rs
11
src/lib.rs
|
|
@ -1,4 +1,9 @@
|
||||||
pub mod api;
|
mod account;
|
||||||
mod auth;
|
|
||||||
mod backup;
|
|
||||||
mod db;
|
mod db;
|
||||||
|
mod model;
|
||||||
|
|
||||||
|
pub fn router() -> axum::Router {
|
||||||
|
axum::Router::new()
|
||||||
|
.nest("/account", account::router())
|
||||||
|
.nest("/predict", model::router())
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
pub fn router() -> axum::Router {
|
||||||
|
axum::Router::new()
|
||||||
|
.route("/",
|
||||||
|
axum::routing::post(get_predict)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn get_predict() {}
|
||||||
Loading…
Reference in New Issue