diff options
| author | Fuwn <[email protected]> | 2021-04-28 13:47:02 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2021-04-28 13:47:02 -0700 |
| commit | e4e2a5f588024bcda97cc426f49d62b066a121fe (patch) | |
| tree | 845d3b6b0a253ac0274ddb06db4aeabbe5526700 /src/main.rs | |
| parent | fix?: CORS (diff) | |
| download | api-e4e2a5f588024bcda97cc426f49d62b066a121fe.tar.xz api-e4e2a5f588024bcda97cc426f49d62b066a121fe.zip | |
fix? CORS again
Diffstat (limited to 'src/main.rs')
| -rw-r--r-- | src/main.rs | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/src/main.rs b/src/main.rs index 66f914c..6a45fac 100644 --- a/src/main.rs +++ b/src/main.rs @@ -11,23 +11,13 @@ pub mod routes; pub mod structures; pub mod utils; -use rocket_cors as cors; +use std::str::FromStr; #[launch] fn rocket() -> _ { dotenv::dotenv().ok(); rocket::build() - .manage( - cors::CorsOptions { - allowed_origins: cors::AllowedOrigins::all(), - allowed_methods: cors::AllowedMethods::new(), - allowed_headers: cors::AllowedHeaders::all(), - ..Default::default() - } - .to_cors() - .unwrap(), - ) .mount("/", routes![routes::index]) .mount( "/api/v1", @@ -38,4 +28,8 @@ fn rocket() -> _ { routes::random ], ) + .manage(rocket_cors::CorsOptions { + allowed_origins: rocket_cors::AllowedOrigins::some_exact(&["*"]), + ..Default::default() + }) } |