use actix_cors::Cors; use actix_web::{http::header, middleware::Logger, App, HttpServer}; mod user; #[actix_web::main] async fn main() -> std::io::Result<()> { std::env::set_var("RUST_LOG", "actix=info"); env_logger::init(); HttpServer::new(move || { App::new() .wrap( Cors::default() .allowed_origin("http://localhost:8080") .allowed_methods(vec!["GET", "POST"]) .allowed_headers(vec![header::AUTHORIZATION, header::ACCEPT]) .allowed_header(header::CONTENT_TYPE) .supports_credentials() .max_age(3600), ) .wrap(Logger::default()) .service(user::info) }) .bind(("127.0.0.1", 8000))? .run() .await }