Update src/main.rs
Browse files- src/main.rs +5 -5
src/main.rs
CHANGED
|
@@ -2,7 +2,6 @@ use actix_cors::Cors;
|
|
| 2 |
use actix_web::{web, App, HttpResponse, HttpServer};
|
| 3 |
use confik::{Configuration as _, EnvSource};
|
| 4 |
use dotenvy::dotenv;
|
| 5 |
-
use actix_cors::Cors;
|
| 6 |
|
| 7 |
mod config;
|
| 8 |
mod db;
|
|
@@ -47,14 +46,15 @@ async fn main() -> std::io::Result<()> {
|
|
| 47 |
|
| 48 |
let supabase = Supabase::new(cfg.supabase_url, cfg.supabase_anon_key);
|
| 49 |
|
| 50 |
-
|
|
|
|
|
|
|
|
|
|
| 51 |
.allowed_origin("https://arami21-space.github.io")
|
| 52 |
.allowed_methods(vec!["GET", "POST"])
|
| 53 |
.allowed_headers(vec!["Content-Type", "Authorization"])
|
| 54 |
.max_age(3600);
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
HttpServer::new(move || {
|
| 58 |
App::new()
|
| 59 |
.wrap(cors)
|
| 60 |
.app_data(web::Data::new(supabase.clone()))
|
|
|
|
| 2 |
use actix_web::{web, App, HttpResponse, HttpServer};
|
| 3 |
use confik::{Configuration as _, EnvSource};
|
| 4 |
use dotenvy::dotenv;
|
|
|
|
| 5 |
|
| 6 |
mod config;
|
| 7 |
mod db;
|
|
|
|
| 46 |
|
| 47 |
let supabase = Supabase::new(cfg.supabase_url, cfg.supabase_anon_key);
|
| 48 |
|
| 49 |
+
|
| 50 |
+
HttpServer::new(move || {
|
| 51 |
+
|
| 52 |
+
let cors = Cors::default()
|
| 53 |
.allowed_origin("https://arami21-space.github.io")
|
| 54 |
.allowed_methods(vec!["GET", "POST"])
|
| 55 |
.allowed_headers(vec!["Content-Type", "Authorization"])
|
| 56 |
.max_age(3600);
|
| 57 |
+
|
|
|
|
|
|
|
| 58 |
App::new()
|
| 59 |
.wrap(cors)
|
| 60 |
.app_data(web::Data::new(supabase.clone()))
|