Launching a basic Actix Web server
Building with Cargo is straightforward. All we need to do is navigate to a directory where we want to build our project and run the following command:
cargo new web_app
The preceding command builds a basic Cargo Rust project. When we explore this application, we get the following structure:
└── web_app ├── Cargo.toml └── src └── main.rs
We can now define our Actix Web dependency in our Cargo.toml
file with the following code:
[dependencies] actix-web = "4.0.1"
As a result of the preceding code, we can now move on to building the web application. For now, we will put it all in our src/main.rs
file with the following code:
use actix_web::{web, App, HttpServer, Responder, ...