mirror of
https://codeberg.org/JasterV/chat-rooms-actix.git
synced 2026-04-26 18:10:04 +00:00
server.rs removed
This commit is contained in:
parent
b9c19337cb
commit
9d264cf3b5
3 changed files with 6 additions and 11 deletions
|
|
@ -1,13 +1,13 @@
|
|||
mod actors;
|
||||
mod constants;
|
||||
mod messages;
|
||||
mod models;
|
||||
mod routes;
|
||||
mod server;
|
||||
mod constants;
|
||||
|
||||
use crate::{actors::chat_server::ChatServer, models::AppState, server::init};
|
||||
use crate::{actors::chat_server::ChatServer, models::AppState};
|
||||
use actix::Actor;
|
||||
use actix_web::{App, HttpServer};
|
||||
use routes::ws::connect;
|
||||
|
||||
#[actix_web::main]
|
||||
async fn main() -> std::io::Result<()> {
|
||||
|
|
@ -15,7 +15,7 @@ async fn main() -> std::io::Result<()> {
|
|||
HttpServer::new(move || {
|
||||
App::new()
|
||||
.data(AppState { chat: chat.clone() })
|
||||
.configure(init)
|
||||
.service(connect)
|
||||
})
|
||||
.bind("127.0.0.1:8080")?
|
||||
.run()
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
use crate::{actors::chat_session::WsChatSession, models::AppState};
|
||||
use actix_web::{web, HttpRequest, Responder};
|
||||
use actix_web::{get, web, HttpRequest, Responder};
|
||||
use actix_web_actors::ws;
|
||||
|
||||
#[get("/ws")]
|
||||
pub async fn connect(
|
||||
req: HttpRequest,
|
||||
stream: web::Payload,
|
||||
|
|
|
|||
|
|
@ -1,6 +0,0 @@
|
|||
use crate::routes::ws::connect;
|
||||
use actix_web::web;
|
||||
|
||||
pub fn init(app: &mut web::ServiceConfig) {
|
||||
app.service(web::resource("/ws").to(connect));
|
||||
}
|
||||
Loading…
Reference in a new issue