rust router skeleton code

Just a basic axum setup with modules
This commit is contained in:
Julia Lange 2025-04-17 16:08:14 -07:00
parent 1f6544a75e
commit 1d577ef396
Signed by: Julia
SSH key fingerprint: SHA256:50XUMcOFYPUs9/1j7p9SPnwASZ7QnxXm7THF7HkbqzQ
4 changed files with 653 additions and 0 deletions

22
rust/src/router.rs Normal file
View file

@ -0,0 +1,22 @@
use axum::{
routing::get,
extract::Path,
Router,
};
use tokio::net::TcpListener;
pub async fn setup() {
let app = Router::new()
.route("/xrpc/{nsid}", get(xrpc_get).post(xrpc_post));
let listener = TcpListener::bind("0.0.0.0:6702").await.unwrap();
axum::serve(listener, app).await.unwrap();
}
async fn xrpc_get(Path(nsid): Path<String>) -> String {
nsid
}
async fn xrpc_post(Path(nsid): Path<String>) -> String {
nsid
}