1use std::net::{IpAddr, Ipv4Addr, SocketAddr};
2
3use aok::Result;
4use axum::{http::StatusCode, routing::post, Router};
5use tokio::net::TcpListener;
6use tracing::info;
7
8genv::def!(PORT:u16 | 2025);
9
10pub async fn run() -> Result<()> {
11 let port = PORT();
12 info!("http://0.0.0.0:{}", port);
13 let app = Router::new().route("/", post(index));
14
15 axum::serve(
16 TcpListener::bind(SocketAddr::new(IpAddr::V4(Ipv4Addr::new(0, 0, 0, 0)), port)).await?,
17 app,
18 )
19 .await?;
20 Ok(())
21}
22
23async fn index() -> &'static str {
24 "Hello, World!"
25}