From cbbb52a1f1ca39d404fa20891b1435a33ee0f183 Mon Sep 17 00:00:00 2001 From: Rob Ede Date: Sat, 8 Jul 2023 17:42:59 +0100 Subject: [PATCH] docs: fix typos --- docs/src/backend/00_backend.md | 2 +- docs/src/backend/01_workspace_setup.md | 4 ++-- docs/src/backend/02_shuttle.md | 6 +++--- docs/src/backend/03_deploying_with_shuttle.md | 2 +- docs/src/backend/07_connecting_the_database.md | 8 +++----- docs/src/backend/12_library.md | 2 +- docs/src/backend/13_health_check.md | 2 +- docs/src/backend/22_implementing_endpoints.md | 3 +-- docs/src/frontend/03_06_building.md | 4 ++-- docs/src/frontend/03_frontend.md | 2 +- 10 files changed, 16 insertions(+), 19 deletions(-) diff --git a/docs/src/backend/00_backend.md b/docs/src/backend/00_backend.md index 60e8cc3..c00b2dd 100644 --- a/docs/src/backend/00_backend.md +++ b/docs/src/backend/00_backend.md @@ -4,7 +4,7 @@ The goal of this part of the workshop is to create a simple API that will be use ## Tools and Frameworks -- [Actix-web](https://actix.rs/) +- [Actix Web](https://actix.rs/) - [SQLx](https://github.com/launchbadge/sqlx) - [Shuttle](https://www.shuttle.rs/) diff --git a/docs/src/backend/01_workspace_setup.md b/docs/src/backend/01_workspace_setup.md index c031987..768d844 100644 --- a/docs/src/backend/01_workspace_setup.md +++ b/docs/src/backend/01_workspace_setup.md @@ -53,9 +53,9 @@ For the `API`, we will create **two crates**: Having two different crates is totally optional, but it will allow us to have a cleaner project structure and will make it easy to reuse the `API` library code if we decide to not use [Shuttle](https://www.shuttle.rs/) in the future. ``` admonish tip title="Shuttle" -Shuttle will allow us to run our API locally and deploy it to the cloud with minial effort but it is not required to build the API. +Shuttle will allow us to run our API locally and deploy it to the cloud with minimal effort but it is not required to build the API. -We could decide to use a different executable to run our API that would use the `lib` crate as a dependency. For instance, we could use `Actix-web` directly to create such a binary and release it as a Docker image. +We could decide to use a different executable to run our API that would use the `lib` crate as a dependency. For instance, we could use Actix Web directly to create such a binary and release it as a Docker image. ``` ### Creating the `lib` crate diff --git a/docs/src/backend/02_shuttle.md b/docs/src/backend/02_shuttle.md index 1e69ad1..955bea2 100644 --- a/docs/src/backend/02_shuttle.md +++ b/docs/src/backend/02_shuttle.md @@ -24,7 +24,7 @@ async fn actix_web( } ``` -[Shuttle](https://www.shuttle.rs) has generated a simple `hello-world` [Actix-web](https://actix.rs) application for us. +[Shuttle](https://www.shuttle.rs) has generated a simple `hello-world` [Actix Web](https://actix.rs) application for us. As you can see, it's pretty straight-forward. @@ -59,12 +59,12 @@ And that's how easy it is to create a simple API with [Shuttle](https://www.shut > Try to add more routes and see what happens! ```admonish -We're using [Actix-web](https://actix.rs) as our web framework, but **you can use any other framework** supported by [Shuttle](https://www.shuttle.rs). +We're using [Actix Web](https://actix.rs) as our web framework, but **you can use any other framework** supported by [Shuttle](https://www.shuttle.rs). Check out the [Shuttle documentation](https://docs.shuttle.rs/introduction/welcome) to learn more. Browse through the `Examples` section to see how to use [Shuttle](https://www.shuttle.rs) with other frameworks. At the moment of writing this, [Shuttle](https://www.shuttle.rs/) supports: -- [Actix-web](https://actix.rs) +- [Actix Web](https://actix.rs) - [Axum](https://github.com/tokio-rs/axum) - [Salvo](https://next.salvo.rs/) - [Poem](https://github.com/poem-web/poem) diff --git a/docs/src/backend/03_deploying_with_shuttle.md b/docs/src/backend/03_deploying_with_shuttle.md index e02788b..2f42ed8 100644 --- a/docs/src/backend/03_deploying_with_shuttle.md +++ b/docs/src/backend/03_deploying_with_shuttle.md @@ -81,7 +81,7 @@ The problem is that we haven't created the project environment yet. Let's do tha cargo shuttle project start ``` -If everthing went well, you should see something like this: +If everything went well, you should see something like this: ![project started](../assets/backend/03/project_started.png) diff --git a/docs/src/backend/07_connecting_the_database.md b/docs/src/backend/07_connecting_the_database.md index 47848ad..8a7c0e9 100644 --- a/docs/src/backend/07_connecting_the_database.md +++ b/docs/src/backend/07_connecting_the_database.md @@ -10,7 +10,7 @@ This will help us to get acquainted with [SQLx](https://github.com/launchbadge/s Don't worry about how to retrieve the information from the database, we will do that in a moment. Just focus on creating and endpoint that will return a string. The string can be anything you want and the route should be `/version`. -If you're not sure about how to do it, uncollapse the section below to see the solution. +If you're not sure about how to do it, expand the section below to see the solution. ~~~admonish tip title="Solution" collapsible=true Open the `main.rs` file in the `api > shuttle > src` folder and add the following code: @@ -124,7 +124,7 @@ async fn version(db: actix_web::web::Data) -> String { There are a couple of things going on here, so let's break it down. -First of all, it's worth noticing that **we changed the return type** of the function to `String`. This obbeys to two different reasons: +First of all, it's worth noticing that **we changed the return type** of the function to `String`. This is for two different reasons: 1. We don't want our endpoint to fail. If the query fails, we will have to return an error message as a `String`. 1. We need that return to be a `String` because the version of the database will come to us as a `String`. @@ -133,7 +133,7 @@ On the other hand, we have the [sqlx::query_scalar](https://docs.rs/sqlx/latest/ As you can see, the **query is pretty simple**. We're just selecting the version of the database. The most interesting part in there is that we need to use the `.get_ref()` method to get a **reference** to the inner `sqlx::PgPool` from the `actix_web::web::Data`. -Finally, we have the [match expression](https://doc.rust-lang.org/reference/expressions/match-expr.html). The [sqlx::query_scalar](https://docs.rs/sqlx/latest/sqlx/query/struct.QueryScalar.html) function will return a [Result](https://doc.rust-lang.org/std/result/enum.Result.html) with either the version of the database or an error. With the [match expression](https://doc.rust-lang.org/reference/expressions/match-expr.html) we're coverging both cases and we will make sure that we will always return a `String`. +Finally, we have the [match expression](https://doc.rust-lang.org/reference/expressions/match-expr.html). The [sqlx::query_scalar](https://docs.rs/sqlx/latest/sqlx/query/struct.QueryScalar.html) function will return a [Result](https://doc.rust-lang.org/std/result/enum.Result.html) with either the version of the database or an error. With the [match expression](https://doc.rust-lang.org/reference/expressions/match-expr.html) we're covering both cases and we will make sure that we will always return a `String`. ```admonish tip Note that most of the time we don't need the return keyword in Rust. The last expression in a function will be the return value. @@ -153,5 +153,3 @@ For now, let's commit our changes: git add . git commit -m "add version endpoint" ``` - - diff --git a/docs/src/backend/12_library.md b/docs/src/backend/12_library.md index d1849f8..b7112a2 100644 --- a/docs/src/backend/12_library.md +++ b/docs/src/backend/12_library.md @@ -2,7 +2,7 @@ The idea behind this section is to **move our endpoints** to a library so that we can **reuse** them in case we want to provide a different binary that doesn't rely on [Shuttle](https://shuttle.rs). -Imagine, for example, that you want to deploy your API to your cloud of choice. Most probably you'll want to use a container to do so. In that case, having our endpoints in a library will allow us to create a binary that works purely on [Actix-web](https://actix.rs). +Imagine, for example, that you want to deploy your API to your cloud of choice. Most probably you'll want to use a container to do so. In that case, having our endpoints in a library will allow us to create a binary that works purely on [Actix Web](https://actix.rs). ## Adding a local dependency diff --git a/docs/src/backend/13_health_check.md b/docs/src/backend/13_health_check.md index 403f709..335f456 100644 --- a/docs/src/backend/13_health_check.md +++ b/docs/src/backend/13_health_check.md @@ -33,7 +33,7 @@ async fn health() -> HttpResponse { - Configure the services in your shuttle crate. Remove the previous services and add the new one. -Your `api > shuttle> src > main.rs` file should look like this: +Your `api > shuttle > src > main.rs` file should look like this: ```rust use actix_web::web::ServiceConfig; diff --git a/docs/src/backend/22_implementing_endpoints.md b/docs/src/backend/22_implementing_endpoints.md index b035c0f..ab96077 100644 --- a/docs/src/backend/22_implementing_endpoints.md +++ b/docs/src/backend/22_implementing_endpoints.md @@ -11,7 +11,7 @@ Indeed, we **shouldn't care about the implementation details** of the `FilmRepos So, it seems clear that we need to get access to the `FilmRepository` instance in our handlers. But how can we do that? ```admonish tip -Refresh your memory by reading about how to handle State in Actix-web in the [official documentation](https://actix.rs/docs/application/#state). +Refresh your memory by reading about how to handle State in Actix Web in the [official documentation](https://actix.rs/docs/application/#state). ``` As you can see, it should be pretty straightforward isn't it? But, wait a minute. We have a problem here. @@ -152,4 +152,3 @@ Commit your changes: git add . git commit -m "implement film endpoints" ``` - diff --git a/docs/src/frontend/03_06_building.md b/docs/src/frontend/03_06_building.md index 70e5c1e..00c6220 100644 --- a/docs/src/frontend/03_06_building.md +++ b/docs/src/frontend/03_06_building.md @@ -6,8 +6,8 @@ Inside our workspace **root** we some handy `cargo-make` tasks for the frontend makers front-build ``` -This will build our frontend for production and place the output in the `shuttle/static` directory. Now we can serve our frontend with the backend. Letś deploy it with Shuttle and see our results. +This will build our frontend for production and place the output in the `shuttle/static` directory. Now we can serve our frontend with the backend. Let's deploy it with Shuttle and see our results. ```bash cargo shuttle deploy -``` \ No newline at end of file +``` diff --git a/docs/src/frontend/03_frontend.md b/docs/src/frontend/03_frontend.md index abd7fcf..5666311 100644 --- a/docs/src/frontend/03_frontend.md +++ b/docs/src/frontend/03_frontend.md @@ -1,6 +1,6 @@ # Frontend -In this guide, we'll be using [Dioxus](https://dioxuslabs.com/) as the frontend for our project. Dioxus is a portable, performant, and ergonomic framework for building cross-platform user interfaces in Rust. Heavily inspired by React, Dioxus allows you to build apps for the Web, Desktop, Mobile, and more. Its core implementation can run anywhere with no platform-dependent linking, which means it's not intrinsically linked to WebSys like many other Rust frontend toolkits. However, it's important to note that Dioxus hasn't reached a stable release yet, so some APIs, particularly for Desktop, may still be inestable. +In this guide, we'll be using [Dioxus](https://dioxuslabs.com/) as the frontend for our project. Dioxus is a portable, performant, and ergonomic framework for building cross-platform user interfaces in Rust. Heavily inspired by React, Dioxus allows you to build apps for the Web, Desktop, Mobile, and more. Its core implementation can run anywhere with no platform-dependent linking, which means it's not intrinsically linked to WebSys like many other Rust frontend toolkits. However, it's important to note that Dioxus hasn't reached a stable release yet, so some APIs, particularly for Desktop, may still be unstable. As for styling our app, we'll be using [Tailwind CSS](https://tailwindcss.com/). Tailwind is a highly customizable, low-level CSS framework that gives you all of the building blocks you need to build bespoke designs without any annoying opinionated styles you have to fight to override. You can set it up in your project, build something with it in an online playground, and even learn more about it directly from the team on their channel. Tailwind also offers a set of beautiful UI components crafted by its creators to help you speed up your development process​.