This is a guide to setting up a simple API using Actix Web in a Rust project.
Before you begin, make sure you have the following installed:
[dependencies]
actix-web = "4.0"
actix-rt = "2.5"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"-
actix-web: The core framework for building web applications with Actix. -
actix-rt: Actix runtime for async programming. -
serdeandserde_json: Serialization and deserialization of data.
Run the following command to fetch the dependencies:
cargo build
To execute this project, it's recommended that you run the following command:
cargo watch -x runOpen your browser or use a tool like curl to test the API:
curl http://127.0.0.1:8080/