Create stub Axum app
This commit is contained in:
parent
02af71212e
commit
70842b1db2
|
|
@ -0,0 +1,10 @@
|
|||
[package]
|
||||
name = "localhub"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
tokio = { version = "1", features = ["rt-multi-thread"]}
|
||||
axum = "0.7"
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
use axum::{routing::get, Router};
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let app = Router::new().route("/", get(root));
|
||||
|
||||
let listener = tokio::net::TcpListener::bind("0.0.0.0:3000").await?;
|
||||
axum::serve(listener, app).await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn root() -> &'static str {
|
||||
"It works!"
|
||||
}
|
||||
Loading…
Reference in New Issue