mylloon.fr/src/main.rs

30 lines
730 B
Rust
Raw Normal View History

2023-02-08 22:14:57 +01:00
use actix_web::{web, App, HttpServer};
2023-02-08 20:49:05 +01:00
mod config;
#[path = "routes/index.rs"]
mod index;
2023-02-08 22:14:57 +01:00
#[path = "routes/agreements.rs"]
mod agreements;
2023-02-08 20:49:05 +01:00
#[actix_web::main]
async fn main() -> std::io::Result<()> {
let config = config::get_config("config/config.toml");
2023-02-08 20:58:24 +01:00
let addr = ("127.0.0.1", config.port);
2023-02-08 20:49:05 +01:00
println!("Listening to {}://{}:{}", config.scheme, addr.0, addr.1);
2023-02-08 20:58:24 +01:00
2023-02-08 22:14:57 +01:00
HttpServer::new(move || {
App::new()
.app_data(web::Data::new(config.clone()))
.service(index::page)
.service(agreements::security)
2023-02-08 22:22:20 +01:00
.service(agreements::humans)
.service(agreements::robots)
.service(agreements::sitemap)
2023-02-08 22:14:57 +01:00
})
.bind(addr)?
.run()
.await
2023-02-02 11:06:27 +01:00
}