Add base server

This commit is contained in:
2023-05-24 14:38:18 +02:00
parent df64d51445
commit 9912428fd6
10 changed files with 1292 additions and 19 deletions

View File

@ -1,3 +1,23 @@
fn main() {
println!("Hello, world!");
use actix_web::{web, App, HttpServer};
use geneit_backend::app_config::AppConfig;
use geneit_backend::controllers::config_controller;
#[actix_web::main]
async fn main() -> std::io::Result<()> {
env_logger::init_from_env(env_logger::Env::new().default_filter_or("info"));
log::info!("Start to listen on {}", AppConfig::get().listen_address);
HttpServer::new(|| {
App::new()
// Config controller
.route("/", web::get().to(config_controller::home))
.route(
"/config/static",
web::get().to(config_controller::static_config),
)
})
.bind(AppConfig::get().listen_address.as_str())?
.run()
.await
}