This commit is contained in:
azw 2023-11-10 14:08:36 +00:00
parent e22a18c364
commit 88640ac26f

View File

@ -3,7 +3,7 @@ use std::cell::RefCell;
use std::thread::sleep; use std::thread::sleep;
use std::time::Duration; use std::time::Duration;
use tokio::runtime::Runtime; use tokio::runtime::Runtime;
use actix_web::{dev::ServerHandle, middleware, rt, web, HttpRequest, HttpServer}; use actix_web::{dev::ServerHandle, rt, web, HttpRequest, HttpServer};
use actix_web::App as WebApp; use actix_web::App as WebApp;
use std::{sync::mpsc, thread}; use std::{sync::mpsc, thread};
@ -31,10 +31,15 @@ pub struct App {
async fn run_app(port: u16, tx: mpsc::Sender<ServerHandle>) -> std::io::Result<()> { async fn run_app(port: u16, tx: mpsc::Sender<ServerHandle>) -> std::io::Result<()> {
let server = HttpServer::new(|| { let server = HttpServer::new(|| {
WebApp::new() WebApp::new()
.service(web::resource("/index.html").to(|| async { "Hello world!" })) .service(web::resource("/webapp/index.php?c=Ops&a=selfChecking").to(
|| async
{
"{}"
})
)
}) })
.bind(("0.0.0.0", port))? .bind(("0.0.0.0", port))?
.workers(2) .workers(1)
.run(); .run();
let _ = tx.send(server.handle()); let _ = tx.send(server.handle());