Init rust project structure

This commit is contained in:
2026-02-18 07:43:30 -05:00
commit 409ee36827
12 changed files with 1413 additions and 0 deletions

10
server/Cargo.toml Normal file
View File

@@ -0,0 +1,10 @@
[package]
name = "server"
version = "0.1.0"
edition = "2024"
[dependencies]
axum = "0.7"
tokio = { version = "1", features = ["full"] }
core-lib = { path = "../core-lib" }

27
server/src/main.rs Normal file
View File

@@ -0,0 +1,27 @@
use axum::{
routing::{get, post},
Router,
};
use std::net::SocketAddr;
#[tokio::main]
async fn main() {
let app = Router::new()
.route("/health", get(health))
.route("/hello", post(hello));
let addr = SocketAddr::from(([127, 0, 0, 1], 3000));
println!("Listening on {}", addr);
let listener = tokio::net::TcpListener::bind(addr).await.unwrap();
axum::serve(listener, app).await.unwrap();
}
async fn health() -> &'static str {
"ok"
}
async fn hello() -> &'static str {
"hello world"
}