Book Image

Rust Web Development with Rocket

By : Karuna Murti
Book Image

Rust Web Development with Rocket

By: Karuna Murti

Overview of this book

Looking for a fast, powerful, and intuitive framework to build web applications? This Rust book will help you kickstart your web development journey and take your Rust programming skills to the next level as you uncover the power of Rocket - a fast, flexible, and fun framework powered by Rust. Rust Web Development with Rocket wastes no time in getting you up to speed with what Rust is and how to use it. You’ll discover what makes it so productive and reliable, eventually mastering all of the concepts you need to play with the Rocket framework while developing a wide set of web development skills. Throughout this book, you'll be able to walk through a hands-on project, covering everything that goes into making advanced web applications, and get to grips with the ins and outs of Rocket development, including error handling, Rust vectors, and wrappers. You'll also learn how to use synchronous and asynchronous programming to improve application performance and make processing user content easy. By the end of the book, you'll have answers to all your questions about creating a web application using the Rust language and the Rocket web framework.
Table of Contents (20 chapters)
1
Part 1: An Introduction to the Rust Programming Language and the Rocket Web Framework
7
Part 2: An In-Depth Look at Rocket Web Application Development
14
Part 3: Finishing the Rust Web Application Development

What this book covers

Chapter 1, Introducing the Rust Language, introduces the Rust language and the tools to build Rust applications.

Chapter 2, Building Our First Rocket Web Application, guides you through creating and configuring a Rocket application.

Chapter 3, Rocket Requests and Responses, introduces the Rocket routes, requests, and responses.

Chapter 4, Building, Igniting, and Launching Rocket, explains two important components of Rocket: state and fairings. State provides reusable objects, and fairings act as the middleware part of the Rocket application. This chapter also explains how to connect a database to the Rocket application.

Chapter 5, Designing a User-Generated Application, explores the process of designing an application and shows how to use Rust modules to create a more manageable web application.

Chapter 6, Implementing User CRUD, guides you on how to create, read, update, and delete (CRUD) objects in the Rocket web application and the database behind the Rocket application.

Chapter 7, Handling Errors in Rust and Rocket, explains how to handle errors in Rust and how we can apply error handling in the Rocket application.

Chapter 8, Serving Static Assets and Templates, shows how to serve files (such as CSS files and JS files) using the Rocket web application. You will also learn how to use a template to create a response for the Rocket web application.

Chapter 9, Displaying Users' Post, guides you through Rust generics and how to use generics to display different types of user posts.

Chapter 10, Uploading and Processing Posts, explains asynchronous programming and multithreading in Rust applications and how to apply these to process user uploads in the Rocket web application.

Chapter 11, Securing and Adding an API and JSON, guides you through creating authentication and authorization in a Rocket web application. This chapter also explains how to create JSON API endpoints and how to secure API endpoints with JWT.

Chapter 12, Testing Your Application, introduces you to testing the Rust application and creating an end-to-end test for the Rocket web application.

Chapter 13, Launching a Rocket Application, explains how to configure the production server to serve requests using the Rocket web application. This chapter also explains how to containerize the Rust application using Docker.

Chapter 14, Building a Full Stack Application, explains how to use the Rust programming language to build a frontend WebAssembly application to complement the Rocket web application.

Chapter 15, Improving the Rocket Application, explains how to improve and scale the Rocket web application. This chapter also introduces you to possible alternatives to the Rocket web framework.