Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Rust Web Programming

You're reading from   Rust Web Programming A hands-on guide to developing fast and secure web apps with the Rust programming language

Arrow left icon
Product type Paperback
Published in Feb 2021
Publisher Packt
ISBN-13 9781800560819
Length 394 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Maxwell Flitton Maxwell Flitton
Author Profile Icon Maxwell Flitton
Maxwell Flitton
Arrow right icon
View More author details
Toc

Table of Contents (19) Chapters Close

Preface 1. Section 1:Setting Up the Web App Structure
2. Chapter 1: Quick Introduction to Rust FREE CHAPTER 3. Chapter 2: Designing Your Web Application in Rust 4. Section 2:Processing Data and Managing Displays
5. Chapter 3: Handling HTTP Requests 6. Chapter 4: Processing HTTP Requests 7. Chapter 5: Displaying Content in the Browser 8. Section 3:Data Persistence
9. Chapter 6: Data Persistence with PostgreSQL 10. Chapter 7: Managing User Sessions 11. Chapter 8: Building RESTful Services 12. Section 4:Testing and Deployment
13. Chapter 9: Testing Our Application Endpoints and Components 14. Chapter 10: Deploying Our Application on AWS 15. Chapter 11: Understanding Rocket Web Framework 16. Assessments 17. Other Books You May Enjoy Appendix A: Understanding the Warp Framework

What this book covers

Chapter 1, Quick Introduction to Rust, focuses on what's different about Rust. It covers the strong typing and ownership of variables in relation to memory management as this could trip up a developer from a dynamic language. It also covers structs and how behavior is added to them with impl blocks. Finally, macros are introduced as these are heavily utilized in web development with Rust, making processing such as JSON serialization straight forward.

Chapter 2, Designing Your Web Application in Rust, covers the basic Cargo tools for managing a Rust project which include running, documenting, and managing dependencies. With this, we'll run code that has been structured in different files and directories (modules) to build some user structs with traits and manage configuration parameters in a config struct from a config JSON file. We'll finally parse parameters into Cargo to determine whether a development or production config file is parsed in.

Chapter 3, Handling HTTP Requests, introduces the Actix Web framework to get a basic web server up and running. With this, we'll manage multiple routes from different modules to host a range of different views in a structured approach. We'll also explore the async and await concepts that are behind the views of Actix.

Chapter 4, Processing HTTP Requests, explains how we pass through params, bodies, headers and forms to the views and process them returning JSON. We'll then build a response struct that enables us to add a code and an optional message.

Chapter 5, Displaying Content in the Browser, displays data from the web app via HTML through different methods using the Actix Web framework and typed crate. We'll then build on this and utilize CSS and JavaScript to enable the HTML page to interact with the web app API.

Chapter 6, Data Persistence with PostgreSQL, explains how we build a database and define user models using structs. We use the methods we learned about in Chapter 4, Processing HTTP Requests, to develop a create/delete use API.

Chapter 7, Managing User Sessions, helps us to build a login system that manages sessions and enforces expiration time frames for these login sessions, utilizing JWT and datetime.

Chapter 8, Building RESTful Services, helps us to create TODO data models that link to the user data model. We'll then build a RESTful CRUD API that manages the TODO tasks around the user.

Chapter 9, Testing Our Application Endpoints and Components, helps us to build unit tests in Rust for the structs that have functionality. We'll then test the API endpoints with Postman and then automate these tests with Newman.

Chapter 10, Deploying Our Application on AWS, helps us to build an automated deployment process for the app on an AWS EC2 instance with NGINX using docker hub.

Chapter 11, Understanding Rocket Web Framework, covers the Rocket framework. We'll explore the main differences between Rocket and Actix. We'll also build a basic server using Rocket and define the routes, and reuse code and modules that we have built before that worked in the Actix Web framework.

Appendix A, Understanding the Warp Framework, explores the main differences between Warp and Actix. We'll also build a basic server using Warp and define the routes.

Assessments, contains the answers to the questions from all the chapters.

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime