#[macro_use] extern crate lazy_static; use actix_web::{App, HttpServer}; use listenfd::ListenFd; mod config; mod error; mod handlers; mod image_api; mod result; #[actix_web::main] async fn main() -> std::io::Result<()> { let mut listenfd = ListenFd::from_env(); let mut server = HttpServer::new(|| { App::new() .service(handlers::hello) .service(handlers::create_image) .service(handlers::get_products) }); server = if let Some(l) = listenfd .take_tcp_listener(0) .expect("Unable to grab TCP listener!") { // "Debug mode" with cargo watch auto-reloading server.listen(l)? } else { // "Release mode" server.bind("127.0.0.1:8000")? }; server.run().await }