1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-08-23 14:05:14 +02:00

refactor service registration process; unify services and resources

This commit is contained in:
Nikolay Kim
2019-03-06 15:47:15 -08:00
parent 5cde4dc479
commit fe22e83144
18 changed files with 845 additions and 779 deletions

View File

@@ -13,7 +13,7 @@
//! extractor allows us to get or set session data.
//!
//! ```rust
//! use actix_web::{App, HttpServer, HttpResponse, Error};
//! use actix_web::{web, App, HttpServer, HttpResponse, Error};
//! use actix_session::{Session, CookieSession};
//!
//! fn index(session: Session) -> Result<&'static str, Error> {
@@ -29,19 +29,17 @@
//! }
//!
//! fn main() -> std::io::Result<()> {
//! let sys = actix_rt::System::new("example"); // <- create Actix runtime
//!
//! # std::thread::spawn(||
//! HttpServer::new(
//! || App::new().middleware(
//! CookieSession::signed(&[0; 32]) // <- create cookie based session middleware
//! .secure(false)
//! )
//! .resource("/", |r| r.to(|| HttpResponse::Ok())))
//! .service(web::resource("/").to(|| HttpResponse::Ok())))
//! .bind("127.0.0.1:59880")?
//! .start();
//! # actix_rt::System::current().stop();
//! sys.run();
//! Ok(())
//! .run()
//! # );
//! # Ok(())
//! }
//! ```
use std::cell::RefCell;