generated from ElnuDev/rust-project
Fix CORS policy
This commit is contained in:
parent
412ca4e538
commit
ba6f91f672
6 changed files with 31 additions and 5 deletions
|
@ -16,3 +16,4 @@ derive_more = "0.99.17"
|
|||
mime = "0.3.17"
|
||||
reqwest = "0.11.18"
|
||||
clap = { version = "4.3.21", features = ["derive"] }
|
||||
actix-cors = "0.6.4"
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
use actix_cors::Cors;
|
||||
use utils::{
|
||||
error::{Error, Result},
|
||||
is_human,
|
||||
|
@ -30,7 +31,11 @@ async fn root(request: HttpRequest) -> Result<impl Responder> {
|
|||
|
||||
#[actix_web::main]
|
||||
async fn main() -> std::io::Result<()> {
|
||||
HttpServer::new(|| App::new().service(root))
|
||||
HttpServer::new(||
|
||||
App::new()
|
||||
.service(root)
|
||||
.wrap(Cors::permissive())
|
||||
)
|
||||
.bind(("127.0.0.1", Args::parse().port))?
|
||||
.run()
|
||||
.await
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue