3 options
Rust web programming : a hands-on guide to developing, packaging, and deploying fully functional rust web applications / Maxwell Flitton.
- Format:
- Book
- Author/Creator:
- Flitton, Maxwell, author.
- Language:
- English
- Subjects (All):
- Rust (Computer program language).
- Programming languages (Electronic computers).
- Application software--Development.
- Application software.
- Physical Description:
- 1 online resource (666 pages)
- Edition:
- Second edition.
- Place of Publication:
- Birmingham, England ; Mumbai : Packt Publishing, [2023]
- Biography/History:
- Flitton Maxwell: Maxwell Flitton is a software engineer who works for the open source financial loss modeling foundation OasisLMF. In 2011, Maxwell achieved his Bachelor of Science degree in nursing from the University of Lincoln, UK. While working 12-hour shifts in the A&E departments of hospitals, Maxwell obtained another degree in physics from the Open University in the UK and then moved on to another milestone, with a postgraduate diploma in physics and engineering in medicine from UCL in London. He's worked on numerous projects such as medical simulation soft ware for the German government and supervising computational medicine students at Imperial College London. He also has experience in financial tech and Monolith AI.
- Summary:
- Use the Rust programming language to build fully functional web applications with async Rust to amplify security and boost the performance of your programs Key Features Work with cutting-edge web techniques such as distroless Rust servers, Terraform, and AWS deployment Get acquainted with async concepts such as actors and queuing tasks using lower-level frameworks like Tokio Build a full web application in Rust with a database, authentication, and frontend Book Description Are safety and high performance a big concern for you while developing web applications? With this practical Rust book, you'll discover how you can implement Rust on the web to achieve the desired performance and security as you learn techniques and tooling to build fully operational web apps. In this second edition, you'll get hands-on with implementing emerging Rust web frameworks, including Actix, Rocket, and Hyper. It also features HTTPS configuration on AWS when deploying a web application and introduces you to Terraform for automating the building of web infrastructure on AWS. What's more, this edition also covers advanced async topics. Built on the Tokio async runtime, this explores TCP and framing, implementing async systems with the actor framework, and queuing tasks on Redis to be consumed by a number of worker nodes. Finally, you'll go over best practices for packaging Rust servers in distroless Rust Docker images with database drivers, so your servers are a total size of 50Mb each. By the end of this book, you'll have confidence in your skills to build robust, functional, and scalable web applications from scratch. What you will learn Structure and build scalable Rust web apps by creating a basic to-do list web app Manage authentication and databases in Rust web applications Get to grips with wrapping web applications in distroless Understand the building blocks of web development such as HTTPS, TCP, and middleware Build app infrastructure on AWS using Terraform with databases, servers, load balancers, HTTPS, and URL routing Build end-to-end tests using Postman Build async systems implementing the actor model using Tokio Who this book is for This Rust programming book is for web developers who want to learn and implement Rust to build web applications. Developers familiar with languages such as Python, Ruby, and JS will be able to use this book to build high performant web apps with Rust. Although no prior experience in Rust is necessary, a solid understanding of web development principles, along with basic knowledge of HTML, CSS, and JavaScript, is necessary to get the most out of this book.
- Contents:
- Cover
- Title Page
- Copyright and Credits
- Contributors
- About the reviewers
- Table of Contents
- Preface
- Part 1: Getting Started with Rust Web Development
- Chapter 1: A Quick Introduction to Rust
- Technical requirements
- Why is Rust revolutionary?
- Reviewing data types and variables in Rust
- Using strings in Rust
- Using integers and floats
- Storing data in vectors and arrays
- Mapping data with HashMaps
- Handling results and errors
- Controlling variable ownership
- Copying variables
- Moving variables
- Immutable borrowing of variables
- Mutable borrowing of variables
- Scopes
- Running through lifetimes
- Building structs
- Verifying with traits
- Metaprogramming with macros
- Summary
- Questions
- Answers
- Further reading
- Chapter 2: Designing Your Web Application in Rust
- Managing a software project with Cargo
- Building with Cargo
- Shipping crates with Cargo
- Documenting with Cargo
- Interacting with Cargo
- Structuring code
- Building to-do structs
- Managing structs with factories
- Defining functionality with traits
- Interacting with the environment
- Reading and writing JSON files
- Revisiting traits
- Processing traits and structs
- Part 2: Processing Data and Managing Displays
- Chapter 3: Handling HTTP Requests
- Introducing the Actix Web framework
- Launching a basic Actix Web server
- Understanding closures
- Understanding asynchronous programming
- Understanding async and await
- Exploring async and await with web programming
- Managing views using the Actix Web framework
- Chapter 4: Processing HTTP Requests
- Getting to know the initial setup for fusing code.
- Passing parameters into views
- Using macros for JSON serialization
- Building our own serialization struct
- Implementing the Serialize trait
- Integrating serialization structs into our application code
- Packaging our custom serialized struct to be returned to users
- Extracting data from views
- Extracting JSON from the body of a request
- Extracting data from the header in requests
- Simplifying header extraction with traits
- Chapter 5: Displaying Content in the Browser
- Serving HTML, CSS, and JavaScript using Rust
- Serving basic HTML
- Reading basic HTML from files
- Serving basic HTML loaded from files
- Adding JavaScript to an HTML file
- Communicating with our server using JavaScript
- Injecting JavaScript into HTML
- Adding the delete endpoint
- Adding a JavaScript loading function
- Adding JavaScript tags in the HTML
- Building a rendering JavaScript function
- Building an API call JavaScript function
- Building JavaScript functions for buttons
- Injecting CSS into HTML
- Adding CSS tags to HTML
- Creating a base CSS
- Creating CSS for the home page
- Serving CSS and JavaScript from Rust
- Inheriting components
- Creating a React app
- Making API calls in React
- Creating custom components in React
- Creating our ToDoItem component
- Constructing and managing custom components in our App component
- Lifting CSS into React
- Converting our React application into a desktop application
- Part 3: Data Persistence
- Chapter 6: Data Persistence with PostgreSQL
- Building our PostgreSQL database
- Why we should use a proper database
- Why use Docker?
- How to use Docker to run a database
- Running a database in Docker.
- Exploring routing and ports in Docker
- Running Docker in the background with Bash scripts
- Connecting to PostgreSQL with Diesel
- Connecting our app to PostgreSQL
- Creating our data models
- Getting data from the database
- Inserting into the database
- Editing the database
- Deleting data
- Configuring our application
- Building a database connection pool
- Chapter 7: Managing User Sessions
- Creating our user model
- Creating a User data module
- Creating a NewUser data model
- Altering the to-do item data model
- Updating the schema file
- Creating and running migration scripts on the database
- Authenticating our users
- Managing user sessions
- Cleaning up authentication requirements
- Configuring expiration of auth tokens
- Adding authentication into our frontend
- Appendix
- Chapter 8: Building RESTful Services
- What are RESTful services?
- Mapping our layered system
- Building a uniform interface
- Implementing statelessness
- Logging our server traffic
- Caching
- Code on demand
- Part 4: Testing and Deployment
- Chapter 9: Testing Our Application Endpoints and Components
- Building our unit tests
- Building JWT unit tests
- Building a configuration for tests
- Defining the requirements for JWT tests
- Building basic function tests for JWT
- Building tests for web requests
- Writing tests in Postman
- Writing ordered requests for tests
- Creating a test for an HTTP request
- Automating Postman tests with Newman
- Building an entire automated testing pipeline
- Chapter 10: Deploying Our Application on AWS
- Technical requirements.
- Setting up our build environment
- Setting up an AWS SSH key for an AWS EC2 instance
- Setting up our AWS client
- Setting up our Terraform build
- Writing our Python application build script
- Writing our Bash deployment script
- Managing our software with Docker
- Writing Docker image files
- Building Docker images
- Building an EC2 build server using Terraform
- Orchestrating builds with Bash
- Writing a Docker image file for the React frontend
- Deploying images onto Docker Hub
- Deploying our application on AWS
- Running our application locally
- Running our application on AWS
- Writing our application build script
- Chapter 11: Configuring HTTPS with NGINX on AWS
- What is HTTPS?
- Binary protocol
- Compressed headers
- Persistent connections
- Multiplex streaming
- Implementing HTTPS locally with docker-compose
- Attaching a URL to our deployed application on AWS
- Attaching an elastic IP to our server
- Registering a domain name
- Enforcing HTTPS on our application on AWS
- Getting certificates for our URL
- Creating multiple EC2 instances
- Creating a load balancer for our traffic
- Creating security groups to lock down and secure traffic
- Updating our Python deployment script for multiple EC2 instances
- Attaching our URL to the load balancer
- Part 5: Making Our Projects Flexible
- Chapter 12: Recreating Our Application in Rocket
- What is Rocket?
- Setting up our server
- Plugging in our existing modules
- Implementing Rocket traits
- Plugging in our existing views
- Accepting and returning JSON
- Returning raw HTML
- Returning status with JSON
- Returning multiple statuses
- Registering our views with Rocket
- Plugging in our existing tests
- Summary.
- Further reading
- Chapter 13: Best Practices for a Clean Web App Repository
- The general layout of a clean repository
- Getting our configuration from environment variables
- Setting up a local development database
- Managing variables in Postman tests
- Building distroless tiny server Docker images
- Building a clean test pipeline
- Building continuous integration with GitHub Actions
- Part 6: Exploring Protocol Programming and Async Concepts with Low-Level Network Applications
- Chapter 14: Exploring the Tokio Framework
- Exploring the Tokio framework for async programming
- Working with workers
- Exploring the actor model for async programming
- Working with channels
- Working with actors in Tokio
- Chapter 15: Accepting TCP Traffic with Tokio
- Exploring TCP
- Accepting TCP
- Processing bytes
- Passing TCP to an actor
- Keeping track of orders with actors
- Chaining communication between actors
- Responding with TCP
- Sending different commands via the client
- Chapter 16: Building Protocols on Top of TCP
- Setting up our TCP client and server
- Setting up our TCP server
- Setting up our TCP client
- Processing bytes using structs
- Creating a message sender client
- Processing messages in the server
- Utilizing framing
- Rewriting our client so that it supports framing
- Rewriting our server so that it supports framing
- Building an HTTP frame on top of TCP
- Chapter 17: Implementing Actors and Async with the Hyper Framework
- Breaking down our project.
- Notes:
- Includes index.
- Description based on print version record.
- ISBN:
- 9781803236650
- 1803236655
- OCLC:
- 1367350570
The Penn Libraries is committed to describing library materials using current, accurate, and responsible language. If you discover outdated or inaccurate language, please fill out this feedback form to report it and suggest alternative language.