adds cors to test in dev environment
This commit is contained in:
@@ -2,6 +2,7 @@ use std::env;
|
||||
use futures::Future;
|
||||
use actix_files as fs;
|
||||
use actix_web::{web, App, HttpServer, HttpResponse, Error};
|
||||
use actix_cors::Cors;
|
||||
use lootalot_db::{Pool, DbApi, QueryResult};
|
||||
|
||||
type AppPool = web::Data<Pool>;
|
||||
@@ -56,6 +57,12 @@ pub(crate) fn serve() -> std::io::Result<()> {
|
||||
HttpServer::new(move || {
|
||||
App::new()
|
||||
.data(pool.clone())
|
||||
.wrap(
|
||||
Cors::new()
|
||||
.allowed_origin("http://localhost:8080")
|
||||
.allowed_methods(vec!["GET", "POST"])
|
||||
.max_age(3600)
|
||||
)
|
||||
.route(
|
||||
"/players",
|
||||
web::get().to_async(move |pool: AppPool| {
|
||||
|
||||
Reference in New Issue
Block a user