Commit 304c1586 authored by Emmanuel Raviart's avatar Emmanuel Raviart
Browse files

Add CORS support.

parent 301cde85
......@@ -12,6 +12,7 @@ use tantivy::schema::Schema;
use tantivy::DocAddress;
use tantivy::Document;
use tantivy::Index;
use tower_web::middleware::cors::{AllowedOrigins, CorsBuilder};
use tower_web::{Response, ServiceBuilder};
#[derive(Response)]
......@@ -149,9 +150,14 @@ fn run_serve(data_dir: &Path, addr: &SocketAddr) -> tantivy::Result<()> {
}
};
let cors = CorsBuilder::new()
.allow_origins(AllowedOrigins::Any { allow_null: true })
.build();
println!("Listening on http://{}", addr);
ServiceBuilder::new()
.resource(issuers_resource)
.middleware(cors)
.run(addr)
.unwrap();
Ok(())
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment