From 93e1545fb7da1f54fcc3dade596185ffe6c7a17d Mon Sep 17 00:00:00 2001 From: Guillermo Ramos Date: Sun, 16 Feb 2025 14:11:44 +0100 Subject: Axum @ web.rs --- src/bin/cli.rs | 12 ++++++++++++ src/bin/web.rs | 19 +++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 src/bin/cli.rs create mode 100644 src/bin/web.rs (limited to 'src/bin') diff --git a/src/bin/cli.rs b/src/bin/cli.rs new file mode 100644 index 0000000..5ca388b --- /dev/null +++ b/src/bin/cli.rs @@ -0,0 +1,12 @@ +use hiccup::{SimUpdate::*, SimUpdates, Simulation}; + +fn main() { + let mut sim = Simulation::new(390_000., 0.028, 30); + let updates: SimUpdates = Amortize(12_000.).every(12).and(Amortize(30_000.).at(1)); + + // let mut sim = Simulation::new(200_000., 0.01621, 30); + // let updates: SimUpdates = SimUpdates::default(); + + sim.run(updates); + sim.render_table(); +} diff --git a/src/bin/web.rs b/src/bin/web.rs new file mode 100644 index 0000000..fed833b --- /dev/null +++ b/src/bin/web.rs @@ -0,0 +1,19 @@ +use axum::{ + response::Html, + routing::get, + Router, +}; + +async fn root_get() -> Html<&'static str> { + Html("

Hello, world!

") +} + +#[tokio::main] +async fn main() { + // build our application with a single route + let app = Router::new().route("/", get(root_get)); + + // 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(); +} -- cgit v1.2.3