This chapter covers
- Deciding which web framework to use
- Creating an architecture
- Designing the API
- Reviewing the libraries and tools we’ll use
- Writing the application scaffolding
- Modeling our data
- Declaring the API routes
- Implementing the API routes
- Handling errors gracefully
- Wrapping up by running our service
In this chapter, we will put much of what we’ve learned in the previous chapters into practice by building a web service with async Rust. For completeness, we’ll write an API client in the next chapter following this one.
I’ll focus mainly on the final code and spend less time discussing syntax, boilerplate, and many alternative implementations. I’m confident you will get the most value from a complete working example. Much of the "how to …" content you might find on the internet (and elsewhere) tends to omit much of the full-picture implementation details and glosses over many complexities, so I will do my best to point out what’s missing from this example and where to go from here. I will not discuss in depth the subjects of deployment, load balancing, state management, cluster management, or high availability because they are outside the scope of this book and not directly related to the Rust language.