Skip to content

Commit

Permalink
enable dev cors
Browse files Browse the repository at this point in the history
  • Loading branch information
randallard committed Dec 31, 2024
1 parent 4d99085 commit b10db07
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use std::net::TcpListener;
use std::sync::RwLock;
use std::collections::HashMap;
use serde_json::json;
use actix_cors::Cors;

use crate::connection::{Connection, ConnectionStatus, Message};
use std::time::SystemTime;
Expand Down Expand Up @@ -51,7 +52,9 @@ impl Server {
let notifications = self.notifications.clone();

HttpServer::new(move || {
let cors = Cors::permissive();
App::new()
.wrap(cors) // Add this line to enable CORS
.app_data(connections.clone())
.app_data(notifications.clone())
.route("/connections", web::post().to(create_connection))
Expand Down

0 comments on commit b10db07

Please sign in to comment.