This commit is contained in:
Joshua Perry 2024-06-06 18:55:49 +01:00
parent fed06f44f9
commit cb11d34e0a
5 changed files with 49 additions and 4 deletions

View File

@ -1 +1,32 @@
//TODO: Api Structure
use axum::{
Router,
routing::{get, post}
};
mod account;
mod model;
pub fn api_router() -> Router {
Router::new()
.nest("/account/:user_id", account_router())
.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("/sign-up",
post(account::post_sign_up)
)
.route("/backup",
post(account::post_backup)
)
.route("/restore",
get(account::get_restore)
)
}

8
src/api/account.rs Normal file
View File

@ -0,0 +1,8 @@
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
src/api/model.rs Normal file
View File

@ -0,0 +1 @@
pub async fn get_predict() {}

View File

@ -1,4 +1,4 @@
mod api;
pub mod api;
mod auth;
mod backup;
mod db;

View File

@ -1,3 +1,8 @@
fn main() {
println!("Hello, world!");
#[tokio::main]
async fn main() {
let app = dermy_server::api::api_router();
let listener = tokio::net::TcpListener::bind("0.0.0.0:3000").await.unwrap();
axum::serve(listener, app).await.unwrap();
}