January 2019
Intermediate to advanced
520 pages
14h 32m
English
Consider the following code:
fn main() { env_logger::init(); let sys = actix::System::new("router"); server::new(|| { // Insert `App` declaration here }).workers(1) .bind("127.0.0.1:8080") .unwrap() .start(); let _ = sys.run();}
We create a new server with the server::new method call that expects a closure to return the App instance. Before we create the App instance, we have to finish our server and run it. The workers method sets the number of threads to run actors.
The next call of the bind method binds the server's socket to an address. If ...
Read now
Unlock full access