api
This commit is contained in:
parent
fed06f44f9
commit
cb11d34e0a
33
src/api.rs
33
src/api.rs
|
|
@ -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)
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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() {}
|
||||
|
|
@ -0,0 +1 @@
|
|||
pub async fn get_predict() {}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
mod api;
|
||||
pub mod api;
|
||||
mod auth;
|
||||
mod backup;
|
||||
mod db;
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue