1
0
mirror of https://github.com/actix/examples synced 2025-06-26 17:17:42 +02:00

v3 examples (#364)

This commit is contained in:
Rob Ede
2020-09-12 16:49:45 +01:00
committed by GitHub
parent 3f2b2708c3
commit 49e29a5751
112 changed files with 251 additions and 333 deletions

View File

@ -1,8 +1,7 @@
use std::sync::mpsc;
use std::{thread, time};
use actix_rt::System;
use actix_web::{dev::Server, middleware, web, App, HttpRequest, HttpServer};
use actix_web::{dev::Server, middleware, rt, web, App, HttpRequest, HttpServer};
async fn index(req: HttpRequest) -> &'static str {
println!("REQ: {:?}", req);
@ -10,7 +9,7 @@ async fn index(req: HttpRequest) -> &'static str {
}
fn run_app(tx: mpsc::Sender<Server>) -> std::io::Result<()> {
let mut sys = System::new("test");
let mut sys = rt::System::new("test");
// srv is server controller type, `dev::Server`
let srv = HttpServer::new(|| {
@ -48,5 +47,5 @@ fn main() {
println!("STOPPING SERVER");
// init stop server and wait until server gracefully exit
System::new("").block_on(srv.stop(true));
rt::System::new("").block_on(srv.stop(true));
}