2024-12-06 15:41:27 +01:00
|
|
|
use actix_web::{get, App, HttpServer};
|
|
|
|
use log::info;
|
|
|
|
|
2024-12-06 16:19:22 +01:00
|
|
|
mod config;
|
|
|
|
|
2024-12-06 15:41:27 +01:00
|
|
|
#[actix_web::main]
|
|
|
|
async fn main() -> Result<(), std::io::Error> {
|
|
|
|
env_logger::init();
|
|
|
|
|
2024-12-06 16:19:22 +01:00
|
|
|
let config = config::parse_config();
|
|
|
|
|
2024-12-06 15:41:27 +01:00
|
|
|
info!("Server starting...");
|
|
|
|
HttpServer::new(|| App::new().service(hello))
|
2024-12-06 16:19:22 +01:00
|
|
|
.bind((config.binding_ip, config.port))?
|
2024-12-06 15:41:27 +01:00
|
|
|
.run()
|
|
|
|
.await
|
|
|
|
}
|
|
|
|
|
|
|
|
#[get("/hello")]
|
|
|
|
async fn hello() -> &'static str {
|
|
|
|
"hello"
|
|
|
|
}
|