Basic Axum

This commit is contained in:
Evie Viau-Chow-Stuart 2023-02-03 03:48:29 -08:00
parent 885c6e6bd9
commit 17f6c045b1
Signed by: evie
GPG key ID: 928652CDFCEC8099
4 changed files with 2341 additions and 2 deletions

2
.cargo/config.toml Normal file
View file

@ -0,0 +1,2 @@
[build]
rustflags = ["--cfg", "tokio_unstable"]

2307
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -6,3 +6,14 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [dependencies]
# Core
tokio = { version = "1.25.0", features = ["full"] }
tracing-subscriber = "0.3.16"
# Database
sea-orm = { version = "0.11.0-rc.1", features = ["sqlx-mysql", "runtime-tokio-rustls", "macros"] }
# Web
axum = "0.6.4"
upon = "0.6.0"

View file

@ -1,3 +1,22 @@
fn main() { use std::net::SocketAddr;
println!("Hello, world!");
use axum::{Router, routing::get};
#[tokio::main]
async fn main() {
tracing_subscriber::fmt::init();
let app = Router::new()
.route("/", get(root));
let listen_addr = SocketAddr::from(([0, 0, 0, 0], 3621));
axum::Server::bind(&listen_addr)
.serve(app.into_make_service())
.await
.unwrap();
} }
async fn root() -> &'static str {
"Hewwo??"
}