Project Setup
Structure the API.
Building a REST API in Rust
In this course you will build a small REST API in Rust. We use the Axum web framework, which is built on Tokio (async runtime) and Tower (middleware). It is ergonomic, type-safe, and widely used in production.
This first lesson sets up the project structure so later lessons can add routes, models, a database, and tests.
Creating the Project
Start with Cargo. A binary project gives you a src/main.rs entry point:
cargo new rest_apicreates the folder.cd rest_apimoves into it.cargo runbuilds and runs.
These are shell and cargo commands, not runnable Rust snippets.
// terminal
// cargo new rest_api
// cd rest_api
// cargo run