Skip to content

Commit

Permalink
permit cors
Browse files Browse the repository at this point in the history
  • Loading branch information
berinaniesh committed Sep 14, 2023
1 parent ad0611e commit 5ff6f35
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
16 changes: 16 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
actix-cors = "0.6.4"
actix-web = "4.4.0"
dotenvy = "0.15.7"
env_logger = "0.10.0"
Expand Down
2 changes: 2 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use serde::{Deserialize, Serialize};
use serde_json::json;
use sqlx::postgres::{PgPool, PgPoolOptions};
use sqlx::FromRow;
use actix_cors::Cors;

#[derive(Debug, Clone)]
struct AppData {
Expand Down Expand Up @@ -223,6 +224,7 @@ async fn main() -> std::io::Result<()> {
env_logger::init();
let server = HttpServer::new(move || {
App::new()
.wrap(Cors::permissive())
.wrap(Logger::default())
.app_data(web::Data::new(app_data.clone()))
.service(home)
Expand Down

0 comments on commit 5ff6f35

Please sign in to comment.