1
0
mirror of https://github.com/actix/examples synced 2025-06-28 18:00:37 +02:00

Updated basics/shutdown-server to v4. (#481)

This commit is contained in:
Christopher Gubbin
2022-01-29 15:24:04 +00:00
committed by GitHub
parent 4d82158b0f
commit a3a4786d00
2 changed files with 5 additions and 5 deletions

View File

@ -29,7 +29,7 @@ async fn main() -> std::io::Result<()> {
let server = HttpServer::new(move || {
// give the server a Sender in .data
App::new()
.data(tx.clone())
.app_data(web::Data::new(tx.clone()))
.wrap(middleware::Logger::default())
.service(hello)
.service(stop)
@ -38,7 +38,7 @@ async fn main() -> std::io::Result<()> {
.run();
// clone the Server handle
let srv = server.clone();
let srv = server.handle();
thread::spawn(move || {
// wait for shutdown signal
rx.recv().unwrap();