1
0
Fork 0
forked from alemi/upub

chore: sample axum route

This commit is contained in:
əlemi 2024-02-09 17:07:55 +01:00
parent c69027638f
commit 6bae33f0a6
Signed by: alemi
GPG key ID: A4895B84D311642C
2 changed files with 18 additions and 2 deletions

View file

@ -6,6 +6,8 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
axum = "0.7.3"
chrono = { version = "0.4.31", features = ["serde"] }
serde = { version = "1.0.193", features = ["derive"] }
serde_json = "1.0.108"
tokio = { version = "1.35.1", features = ["full"] }

View file

@ -1,5 +1,19 @@
pub mod model;
fn main() {
println!("Hello, world!");
use axum::{
routing::get,
Router,
};
#[tokio::main]
async fn main() {
// build our application with a single route
let app = Router::new().route("/", get(|| async { "Hello, World!" }));
// run our app with hyper, listening globally on port 3000
let listener = tokio::net::TcpListener::bind("0.0.0.0:3000").await.unwrap();
axum::serve(listener, app)
.await
.unwrap();
}