web/src/main.rs

24 lines
647 B
Rust
Raw Normal View History

use std::env;
use actix_files as fs;
use actix_web::{App, HttpServer, middleware, web};
use env_logger;
mod relay;
#[actix_web::main]
async fn main() -> std::io::Result<()> {
env_logger::init_from_env(env_logger::Env::default().default_filter_or("info"));
HttpServer::new(|| {
App::new()
.wrap(middleware::Logger::default())
.configure(relay::configure)
.service(
fs::Files::new("/", "./public/")
.index_file("index.html")
)
})
.bind(env::var("BIND_ADDRESS").unwrap_or(String::from("0.0.0.0:8080")))?
.run()
.await
}