CORS allowed added
This commit is contained in:
@@ -13,3 +13,4 @@ serde = { version = "1.0.219", features = ["derive"] }
|
|||||||
chrono = { version = "0.4.40", features = ["serde"] }
|
chrono = { version = "0.4.40", features = ["serde"] }
|
||||||
serde_json = "1.0.51"
|
serde_json = "1.0.51"
|
||||||
actix-rt = "2.10.0"
|
actix-rt = "2.10.0"
|
||||||
|
actix-cors = "0.7.1"
|
||||||
|
|||||||
12
src/main.rs
12
src/main.rs
@@ -1,28 +1,28 @@
|
|||||||
extern crate actix_web;
|
extern crate actix_web;
|
||||||
extern crate diesel;
|
extern crate diesel;
|
||||||
use std::{io};
|
use std::io;
|
||||||
|
|
||||||
|
use actix_cors::Cors;
|
||||||
use actix_web::{middleware, App, HttpServer};
|
use actix_web::{App, HttpServer, middleware};
|
||||||
use diesel::r2d2::{ConnectionManager, Pool, PooledConnection};
|
|
||||||
use diesel::PgConnection;
|
use diesel::PgConnection;
|
||||||
|
use diesel::r2d2::{ConnectionManager, Pool, PooledConnection};
|
||||||
|
|
||||||
|
mod connection;
|
||||||
mod constants;
|
mod constants;
|
||||||
mod loota;
|
mod loota;
|
||||||
mod models;
|
mod models;
|
||||||
mod schema;
|
mod schema;
|
||||||
mod connection;
|
|
||||||
|
|
||||||
pub type DBPool = Pool<ConnectionManager<PgConnection>>;
|
pub type DBPool = Pool<ConnectionManager<PgConnection>>;
|
||||||
pub type DBPooledConnection = PooledConnection<ConnectionManager<PgConnection>>;
|
pub type DBPooledConnection = PooledConnection<ConnectionManager<PgConnection>>;
|
||||||
|
|
||||||
|
|
||||||
#[actix_rt::main]
|
#[actix_rt::main]
|
||||||
async fn main() -> io::Result<()> {
|
async fn main() -> io::Result<()> {
|
||||||
env_logger::init();
|
env_logger::init();
|
||||||
|
|
||||||
HttpServer::new(|| {
|
HttpServer::new(|| {
|
||||||
App::new()
|
App::new()
|
||||||
|
.wrap(Cors::permissive())
|
||||||
.wrap(middleware::Logger::default())
|
.wrap(middleware::Logger::default())
|
||||||
.service(loota::get)
|
.service(loota::get)
|
||||||
.service(loota::get_admin_orders)
|
.service(loota::get_admin_orders)
|
||||||
|
|||||||
Reference in New Issue
Block a user