Skip to content

Commit

Permalink
Introduce CORS Headers
Browse files Browse the repository at this point in the history
  • Loading branch information
lucemans committed Jul 5, 2023
1 parent 8207f33 commit 74aaec5
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 10 deletions.
49 changes: 41 additions & 8 deletions Cargo.lock

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

9 changes: 7 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ license = "GPL-3.0"
homepage = "enstate.rs"
description = "enstate"
repository = "https://github.com/v3xlabs/enstate"
authors = ["Luc van Kampen <luc@v3x.email>", "Miguel Piedrafita <sup@miguel.build>"]
authors = [
"Luc van Kampen <luc@v3x.email>",
"Miguel Piedrafita <sup@miguel.build>",
]

[dependencies]
ethers = "2"
Expand All @@ -20,7 +23,9 @@ tokio = { version = "1.28.0", features = ["full"] }
utoipa = { version = "3.0.3", features = ["axum_extras"] }
utoipa-swagger-ui = { version = "3.0.2", features = ["axum"] }
redis = { version = "0.23.0", features = ["connection-manager", "tokio-comp"] }
ethers-ccip-read = { git = "https://github.com/lucemans/ethers-ccip-read", branch = "main" }
ethers-ccip-read = { git = "https://github.com/ensdomains/ethers-ccip-read", branch = "main" }
tower-http = { version = "0.4.1", features = ["cors", "tracing"] }


[build-dependencies]
chrono = "0.4.24"
2 changes: 2 additions & 0 deletions src/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use axum::{routing::get, Router};
use std::net::SocketAddr;
use utoipa::OpenApi;
use utoipa_swagger_ui::SwaggerUi;
use tower_http::cors::CorsLayer;

use crate::routes;

Expand Down Expand Up @@ -33,6 +34,7 @@ impl App {

pub fn setup(state: AppState) -> App {
let router = Router::new()
.layer(CorsLayer::permissive())
.merge(SwaggerUi::new("/docs").url("/docs/openapi.json", ApiDoc::openapi()))
.route("/", get(routes::root::get))
.route("/a/:address", get(routes::address::get))
Expand Down

0 comments on commit 74aaec5

Please sign in to comment.