This commit is contained in:
Benjamin Sherriff
2023-10-05 09:07:53 -04:00
parent ac17be838a
commit 1b41849115
54 changed files with 6473 additions and 129 deletions

View File

@@ -4,6 +4,7 @@ extern crate diesel_migrations;
use std::env;
use actix_cors::Cors;
use actix_web::{HttpServer, App};
use dotenv::dotenv;
@@ -22,9 +23,15 @@ async fn main() -> std::io::Result<()> {
let port = env::var("SERVICE_PORT").unwrap_or("5000".to_string());
match HttpServer::new(|| {
let cors = Cors::default()
.allow_any_origin()
.allow_any_method()
.allow_any_header()
.max_age(3600);
App::new()
.configure(db::messages::init_routes)
.configure(db::spells::init_routes)
.wrap(cors)
})
.bind(format!("{}:{}", host, port)) {
Ok(b) => {