Skip to content

Commit

Permalink
Merge pull request #34 from SakaDream/make-it-works-with-yew-address-…
Browse files Browse the repository at this point in the history
…book-frontend

Make it works with yew address book project
  • Loading branch information
SakaDream committed Feb 20, 2021
2 parents 7a68d53 + 758efd9 commit 636d6e5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/main.rs
Expand Up @@ -57,14 +57,16 @@ async fn main() -> io::Result<()> {
HttpServer::new(move || {
App::new()
.wrap(Cors::default() // allowed_origin return access-control-allow-origin: * by default
// .allowed_origin("http://127.0.0.1:8080")
.allowed_origin("http://127.0.0.1:3000")
.allowed_origin("http://localhost:3000")
.send_wildcard()
.allowed_methods(vec!["GET", "POST", "PUT", "DELETE"])
.allowed_headers(vec![http::header::AUTHORIZATION, http::header::ACCEPT])
.allowed_header(http::header::CONTENT_TYPE)
.max_age(3600))
.data(pool.clone())
.wrap(actix_web::middleware::Logger::default())
// If you want to use yew-address-book-frontend, please comment an auth_middleware wrapping code
.wrap(crate::middleware::auth_middleware::Authentication)
.wrap_fn(|req, srv| {
srv.call(req).map(|res| res)
Expand Down

0 comments on commit 636d6e5

Please sign in to comment.