All rights of books and documents belong to the authors, editors, and translators, the goal of this site is to facilitate reading.
If there is anything improper, please contact email@example.com.
##### The Hitchhiker's Guide to Rust Web
目前，仅是个人 Rust Web 开发中的一些记录。
涵盖：Rust Web 生态中的 Tide、actix-web、Yew、async-graphql、surf、handlebars-rust、rhai、jsonwebtoken，以及 mongodb 等。
Async-graphql is a GraphQL server-side library implemented in Rust. It is fully compatible with the GraphQL specification and most of its extensions, and offers type safety and high performance.
You can define a Schema in Rust and procedural macros will automatically generate code for a GraphQL query. This library does not extend Rust’s syntax, which means that Rustfmt can be used normally. I value this highly and it is one of the reasons why I developed Async-graphql.
Juniper is a GraphQL server library for Rust. Build type-safe and fast API servers with minimal boilerplate and configuration.
GraphQL is a data query language developed by Facebook intended to serve mobile and web application frontends.
Juniper makes it possible to write GraphQL servers in Rust that are type-safe and blazingly fast. We also try to make declaring and resolving GraphQL schemas as convenient as possible as Rust will allow.
Juniper does not include a web server - instead it provides building blocks to make integration with existing servers straightforward. It optionally provides a pre-built integration for the Hyper, Iron, Rocket, and Warp frameworks, including embedded Graphiql for easy debugging.
Juniper supports the full GraphQL query language according to the specification (October 2021), including interfaces, unions, schema introspection, and validations. It does not, however, support the schema language.
As an exception to other GraphQL libraries for other languages, Juniper builds non-null types by default. A field of type Vec\<Episode\> will be converted into \[Episode!\]!. The corresponding Rust type for e.g. \[Episode\] would be Option\<Vec\<Option\<Episode\>\>\>.
Tide is a minimal and pragmatic Rust web application framework built for
rapid development. It comes with a robust set of features that make building
async web applications and APIs easier and more fun.
This Tide-book is still a work in progress, and will be expanded on over time.
All examples in the text are available as [working Tide-projects](https://github.com/http-rs/tide-book/tree/main/examples)
- Clean boilerplate for graphql services using tide, rhai, async-graphql, surf, graphql-client, handlebars-rust, jsonwebtoken, and mongodb.
- Graphql Services: User register, Salt and hash a password with PBKDF2 , Sign in， JSON web token authentication, Change password， Profile Update, User's query & mutation, and Project's query & mutation.
- Web Application: Client request, bring & parse GraphQL data, Render data to template engine(handlebars-rust)， Define custom helper with Rhai scripting language.
- The Blog built on Tide stack, generated from [tide-async-graphql-mongodb](https://github.com/zzy/tide-async-graphql-mongodb).
- Backend for graphql services using tide, async-graphql, jsonwebtoken, mongodb and so on.
- Frontend for web application using tide, rhai, surf, graphql_client, handlebars-rust, cookie and so on.