CORS allowed added

This commit is contained in:
2025-06-17 18:16:43 +03:00
parent 5265037add
commit b570da2f38
2 changed files with 12 additions and 11 deletions

View File

@@ -13,3 +13,4 @@ serde = { version = "1.0.219", features = ["derive"] }
chrono = { version = "0.4.40", features = ["serde"] }
serde_json = "1.0.51"
actix-rt = "2.10.0"
actix-cors = "0.7.1"

View File

@@ -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<ConnectionManager<PgConnection>>;
pub type DBPooledConnection = PooledConnection<ConnectionManager<PgConnection>>;
#[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
.bind("0.0.0.0:9090")?
.run()
.await
}