fix: cors needs to be attached
This commit is contained in:
@@ -34,6 +34,9 @@ async fn rocket() -> _ {
|
|||||||
// Launch background task workers.
|
// Launch background task workers.
|
||||||
async_std::task::spawn(revolt_quark::tasks::start_workers(db.clone()));
|
async_std::task::spawn(revolt_quark::tasks::start_workers(db.clone()));
|
||||||
|
|
||||||
|
// Configure CORS
|
||||||
|
let cors = revolt_quark::web::cors::new();
|
||||||
|
|
||||||
// Configure Rocket
|
// Configure Rocket
|
||||||
let rocket = rocket::build();
|
let rocket = rocket::build();
|
||||||
routes::mount(rocket)
|
routes::mount(rocket)
|
||||||
@@ -42,6 +45,7 @@ async fn rocket() -> _ {
|
|||||||
.mount("/swagger/", revolt_quark::web::swagger::routes())
|
.mount("/swagger/", revolt_quark::web::swagger::routes())
|
||||||
.manage(rauth)
|
.manage(rauth)
|
||||||
.manage(db)
|
.manage(db)
|
||||||
|
.manage(cors.clone())
|
||||||
.attach(revolt_quark::web::ratelimiter::RatelimitFairing)
|
.attach(revolt_quark::web::ratelimiter::RatelimitFairing)
|
||||||
.attach(revolt_quark::web::cors::fairing())
|
.attach(cors)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ use std::str::FromStr;
|
|||||||
pub use rocket_cors::catch_all_options_routes;
|
pub use rocket_cors::catch_all_options_routes;
|
||||||
use rocket_cors::{AllowedOrigins, Cors};
|
use rocket_cors::{AllowedOrigins, Cors};
|
||||||
|
|
||||||
pub fn fairing() -> Cors {
|
pub fn new() -> Cors {
|
||||||
rocket_cors::CorsOptions {
|
rocket_cors::CorsOptions {
|
||||||
allowed_origins: AllowedOrigins::All,
|
allowed_origins: AllowedOrigins::All,
|
||||||
allowed_methods: [
|
allowed_methods: [
|
||||||
|
|||||||
@@ -10,3 +10,9 @@ services:
|
|||||||
- "27017:27017"
|
- "27017:27017"
|
||||||
volumes:
|
volumes:
|
||||||
- ./.data/db:/data/db
|
- ./.data/db:/data/db
|
||||||
|
mongo-express:
|
||||||
|
image: mongo-express
|
||||||
|
ports:
|
||||||
|
- "8081:8081"
|
||||||
|
environment:
|
||||||
|
- ME_CONFIG_MONGODB_SERVER=database
|
||||||
|
|||||||
Reference in New Issue
Block a user