-
Book Overview & Buying
-
Table Of Contents
The Rust Programming Handbook
By :
And with that, we’ve successfully built a complete full-stack application in Rust!
Let’s have a quick recap.
This chapter was an exciting, fast-paced adventure that brought everything we’ve learned together, from the backend to the browser!
We started by creating a backend API from scratch with Axum, a modern and user-friendly web framework. Along the way, we learned to define routes, write async handlers, and use extractors to handle JSON and path parameters.
We initially crafted a simple in-memory todo list with Arc<Mutex<...>> to manage state, and then enhanced it by making it persistent. To do this, we replaced the in-memory Vec with a real PostgreSQL database.
We chose the sqlx crate, which allowed us to write pure-Rust, async database code without complex C dependencies. We set up a connection pool, added a CREATE TABLE IF NOT EXISTS query right in our main function to initialize the database, and refactored our handlers...