Skip to content

Commit

Permalink
fixing cors issues with the API post endpoint (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
tee8z authored Aug 18, 2024
1 parent f2f6ca1 commit 03d4f74
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion daemon/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "daemon"
version = "1.0.2"
version = "1.0.3"
edition = "2021"
repository = "https://github.com/tee8z/noaa-data-pipeline"

Expand Down
2 changes: 1 addition & 1 deletion oracle/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "oracle"
version = "1.0.2"
version = "1.0.3"
edition = "2021"
repository = "https://github.com/tee8z/noaa-data-pipeline"

Expand Down
5 changes: 3 additions & 2 deletions oracle/src/startup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use axum::{
routing::{get, post},
Router,
};
use hyper::Method;
use hyper::{Method, header::{ACCEPT, CONTENT_TYPE}};
use log::info;
use std::sync::Arc;
use tower_http::{
Expand Down Expand Up @@ -103,7 +103,8 @@ pub fn app(app_state: AppState) -> Router {
let serve_dir = ServeDir::new("ui").not_found_service(ServeFile::new(app_state.ui_dir.clone()));
let cors = CorsLayer::new()
// allow `GET` and `POST` when accessing the resource
.allow_methods([Method::GET, Method::POST])
.allow_methods([Method::GET, Method::POST, Method::OPTIONS])
.allow_headers([ACCEPT,CONTENT_TYPE])
// allow requests from any origin
.allow_origin(Any);
Router::new()
Expand Down

0 comments on commit 03d4f74

Please sign in to comment.