diff --git a/Cargo.toml b/Cargo.toml index 8470541..a983618 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,4 +12,5 @@ env_logger = "0.11.8" serde = { version = "1.0.219", features = ["derive"] } chrono = { version = "0.4.40", features = ["serde"] } serde_json = "1.0.51" -actix-rt = "2.10.0" \ No newline at end of file +actix-rt = "2.10.0" +actix-cors = "0.7.1" diff --git a/src/main.rs b/src/main.rs index df321bb..58a370a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,28 +1,28 @@ extern crate actix_web; extern crate diesel; -use std::{io}; +use std::io; - -use actix_web::{middleware, App, HttpServer}; -use diesel::r2d2::{ConnectionManager, Pool, PooledConnection}; +use actix_cors::Cors; +use actix_web::{App, HttpServer, middleware}; use diesel::PgConnection; +use diesel::r2d2::{ConnectionManager, Pool, PooledConnection}; +mod connection; mod constants; mod loota; mod models; mod schema; -mod connection; pub type DBPool = Pool>; pub type DBPooledConnection = PooledConnection>; - #[actix_rt::main] async fn main() -> io::Result<()> { env_logger::init(); HttpServer::new(|| { App::new() + .wrap(Cors::permissive()) .wrap(middleware::Logger::default()) .service(loota::get) .service(loota::get_admin_orders) @@ -30,7 +30,7 @@ async fn main() -> io::Result<()> { .service(loota::get_admin_boxes) .service(loota::update) }) - .bind("0.0.0.0:9090")? - .run() - .await -} \ No newline at end of file + .bind("0.0.0.0:9090")? + .run() + .await +}