2023-03-11 21:44:17 +01:00
|
|
|
use axum::Router;
|
2023-03-11 21:08:09 +01:00
|
|
|
use std::net::SocketAddr;
|
|
|
|
|
2023-03-11 22:45:14 +01:00
|
|
|
mod color;
|
2023-03-11 21:44:17 +01:00
|
|
|
mod polygon;
|
|
|
|
mod routes;
|
|
|
|
|
|
|
|
#[derive(Clone)]
|
|
|
|
pub struct SharedState {}
|
|
|
|
|
2023-03-11 21:08:09 +01:00
|
|
|
#[tokio::main]
|
|
|
|
async fn main() {
|
2023-03-11 21:44:17 +01:00
|
|
|
let state = SharedState {};
|
|
|
|
let app = Router::new()
|
2023-03-11 22:45:14 +01:00
|
|
|
.nest("/", routes::static_files::routes())
|
2023-03-11 21:44:17 +01:00
|
|
|
.nest("/logo", routes::logo::routes())
|
|
|
|
.nest("/favicon.ico", routes::favicon::routes())
|
|
|
|
.with_state(state);
|
2023-03-11 21:08:09 +01:00
|
|
|
|
|
|
|
// run it
|
|
|
|
let addr = SocketAddr::from(([127, 0, 0, 1], 3000));
|
|
|
|
println!("listening on {}", addr);
|
|
|
|
axum::Server::bind(&addr)
|
|
|
|
.serve(app.into_make_service())
|
|
|
|
.await
|
|
|
|
.unwrap();
|
|
|
|
}
|