Skip to content

Commit

Permalink
Add CORS support
Browse files Browse the repository at this point in the history
  • Loading branch information
imclint21 committed Dec 30, 2019
1 parent ddfadcc commit 2c7a3e4
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ impl Server {

let log = warp::log("lucid::Server");

let cors = warp::cors()
.allow_methods(vec!["HEAD", "GET", "PUT", "POST", "PATCH", "DELETE"])
.allow_any_origin();

let routes = api_kv_key
.or(webui)
.or(robots)
Expand All @@ -111,6 +115,7 @@ impl Server {
"Server",
format!("Lucid v{}", crate_version!()),
))
.with(cors)
.with(log);

let instance = warp::serve(routes);
Expand Down

0 comments on commit 2c7a3e4

Please sign in to comment.