From 8186a8cfea590bf7665947c266388306770d1661 Mon Sep 17 00:00:00 2001 From: Altug Sahin Date: Wed, 6 Oct 2021 17:28:53 -0400 Subject: [PATCH] fix broken links (#441) Co-authored-by: Igor Aleksanov Co-authored-by: Altug Sahin Co-authored-by: Rob Ede --- basics/basics/README.md | 7 +++---- basics/json-validation/README.md | 20 +++++++++++++------ basics/middleware/README.md | 2 +- basics/nested-routing/README.md | 17 ++++++++++++++++ basics/shutdown-server/README.md | 1 + basics/state/README.md | 2 +- basics/static_index/README.md | 8 ++++++-- basics/todo/README.md | 2 +- .../simple-auth-server/README.md | 15 +++++++++++--- forms/multipart-async-std/README.md | 5 +++++ forms/multipart-s3/README.md | 4 ++-- forms/multipart/README.md | 5 +++++ graphql/graphql-demo/README.md | 1 + graphql/juniper-advanced/README.md | 8 ++++---- graphql/juniper/README.md | 2 +- json/json/README.md | 2 +- json/json_decode_error/README.md | 2 +- json/jsonrpc/README.md | 3 ++- other/protobuf/README.md | 1 + other/server-sent-events/README.md | 5 +++-- other/udp-echo/README.md | 2 +- other/unix-socket/README.md | 8 ++++++-- security/casbin/README.md | 6 +++--- security/openssl/README.md | 4 ++-- security/rustls-client-cert/README.md | 2 +- security/rustls/README.md | 2 +- security/web-cors/README.md | 4 ++-- session/cookie-auth/README.md | 6 ++++++ session/cookie-session/README.md | 2 +- session/redis-session/README.md | 14 +++++++++++++ template_engines/handlebars/README.md | 5 +++++ template_engines/tera/README.md | 2 +- template_engines/tinytemplate/README.md | 2 +- template_engines/yarte/README.md | 2 +- websockets/chat-broker/README.md | 2 +- 35 files changed, 128 insertions(+), 47 deletions(-) diff --git a/basics/basics/README.md b/basics/basics/README.md index f6b72aa..a183798 100644 --- a/basics/basics/README.md +++ b/basics/basics/README.md @@ -5,18 +5,17 @@ ### server ```bash -cd examples/basics +cd basics/basics cargo run # Started http server: 127.0.0.1:8080 ``` ### web client -- [http://localhost:8080/](http://localhost:8080/static/index.html) - [http://localhost:8080/async-body/bob](http://localhost:8080/async-body/bob) -- [http://localhost:8080/user/bob/](http://localhost:8080/user/bob/) text/plain download +- [http://localhost:8080/user/bob/](http://localhost:8080/user/bob) text/plain download - [http://localhost:8080/test](http://localhost:8080/test) (return status switch GET or POST or other) - [http://localhost:8080/favicon](http://localhost:8080/favicon) - [http://localhost:8080/welcome](http://localhost:8080/static/welcome.html) - [http://localhost:8080/notexit](http://localhost:8080/static/404.html) display 404 page -- [http://localhost:8080/error](http://localhost:8080/error) Panic after request +- [http://localhost:8080/error](http://localhost:8080/error) Panic after request \ No newline at end of file diff --git a/basics/json-validation/README.md b/basics/json-validation/README.md index 1b446fc..90c8594 100644 --- a/basics/json-validation/README.md +++ b/basics/json-validation/README.md @@ -1,12 +1,12 @@ This is a contrived example intended to illustrate a few important actix-web features. -*Imagine* that you have a process that involves 3 steps. The steps here -are dumb in that they do nothing other than call an -httpbin endpoint that returns the json that was posted to it. The intent here -is to illustrate how to chain these steps together as futures and return -a final result in a response. +*Imagine* that you have a process that involves 3 steps. The steps here +are dumb in that they do nothing other than call an HTTP endpoint that +returns the json that was posted to it. The intent here is to illustrate +how to chain these steps together as futures and return a final result +in a response. -Actix-web features illustrated here include: +Actix Web features illustrated here include: 1. handling json input param 2. validating user-submitted parameters using the 'validator' crate @@ -15,5 +15,13 @@ Actix-web features illustrated here include: 3. chaining futures into a single response used by an asynch endpoint +### server + +```bash +cd basics/json-validation +cargo run +# Started http server: 127.0.0.1:8080 +``` + Example query from the command line using httpie: ```echo '{"id":"1", "name": "JohnDoe"}' | http 127.0.0.1:8080/something``` diff --git a/basics/middleware/README.md b/basics/middleware/README.md index f87dc46..0c19235 100644 --- a/basics/middleware/README.md +++ b/basics/middleware/README.md @@ -5,7 +5,7 @@ This example showcases a bunch of different uses of middlewares. See also the [M ## Usage ```bash -cd middleware +cd basics/middleware cargo run # Started http server: 127.0.0.1:8080 ``` diff --git a/basics/nested-routing/README.md b/basics/nested-routing/README.md index 68374f9..43ed4a1 100644 --- a/basics/nested-routing/README.md +++ b/basics/nested-routing/README.md @@ -1,3 +1,20 @@ This example illustrates how to use nested resource registration through application-level configuration. The endpoints do nothing. +## Usage + +```bash +cd basics/nested-routing +cargo run +# Started http server: 127.0.0.1:8080 +``` + +### Available Routes + +- [POST /products](http://localhost:8080/products) +- [GET /products](http://localhost:8080/products) +- [GET /products/:product_id](http://localhost:8080/products/:product_id) +- [DELETE /products/:product_id](http://localhost:8080/products/:product_id) +- [GET /products/:product_id/parts](http://localhost:8080/products/:product_id/parts) +- [POST /products/:product_id/parts](http://localhost:8080/products/:product_id/parts) +- [GET /products/:product_id/parts/:part_id](http://localhost:8080/products/:product_id/parts/:part_id) diff --git a/basics/shutdown-server/README.md b/basics/shutdown-server/README.md index 7a23c70..5d0c28e 100644 --- a/basics/shutdown-server/README.md +++ b/basics/shutdown-server/README.md @@ -14,6 +14,7 @@ Demonstrates how to shutdown the web server in a couple of ways: ### Running The Server ```bash +cd basics/shutdown-server cargo run --bin shutdown-server # Starting 8 workers diff --git a/basics/state/README.md b/basics/state/README.md index 6f85b4e..f57edc0 100644 --- a/basics/state/README.md +++ b/basics/state/README.md @@ -5,7 +5,7 @@ ### server ```bash -cd examples/state +cd basics/state cargo run # Started http server: 127.0.0.1:8080 ``` diff --git a/basics/static_index/README.md b/basics/static_index/README.md index 5e3f666..07214a2 100644 --- a/basics/static_index/README.md +++ b/basics/static_index/README.md @@ -9,8 +9,12 @@ Demonstrates how to serve static files. Inside the `./static` folder you will fi ## Usage ```bash -$ cd examples/static_index +$ cd basics/static_index $ cargo run ``` -This will start the server on port 8080, it can be viewed at [http://localhost:8080](http://localhost:8080). +### Available Routes + +- [GET /](http://localhost:8080/) +- [GET /images](http://localhost:8080/images) + diff --git a/basics/todo/README.md b/basics/todo/README.md index b3e0aa5..9c3bf11 100644 --- a/basics/todo/README.md +++ b/basics/todo/README.md @@ -14,7 +14,7 @@ A port of the [Rocket Todo example](https://github.com/SergioBenitez/Rocket/tree All instructions assume you have changed into this folder: ```bash -cd examples/todo +cd basics/todo ``` ## Set up the database diff --git a/database_interactions/simple-auth-server/README.md b/database_interactions/simple-auth-server/README.md index eba499f..98f66f8 100644 --- a/database_interactions/simple-auth-server/README.md +++ b/database_interactions/simple-auth-server/README.md @@ -1,12 +1,21 @@ ## Auth Web Microservice with rust using Actix-Web 1.0 -##### Flow of the event would look like this: +### Flow of the event would look like this: - Registers with email address ➡ Receive an 📨 with a link to verify - Follow the link ➡ register with same email and a password - Login with email and password ➡ Get verified and receive auth cookie -##### Crates Used +### Available Routes + +- [GET /](http://localhost:8080/) +- [POST /api/invitation](http://localhost:8080/api/invitation) +- [POST /api/invitation/:invitation_id](http://localhost:8080/api/invitation/:invitation_id) +- [GET /api/auth](http://localhost:8080/api/auth) +- [POST /api/auth](http://localhost:8080/api/auth) +- [DELETE /api/auth](http://localhost:8080/api/auth) + +### Crates Used - [actix-web](https://crates.io/crates/actix-web) // Actix web is a simple, pragmatic and extremely fast web framework for Rust. - [rust-argon2](https://crates.io/crates/rust-argon2) // crate for hashing passwords using the cryptographically-secure Argon2 hashing algorithm. @@ -29,7 +38,7 @@ Read the full tutorial series on [gill.net.in](https://gill.net.in) - [Auth Web Microservice with Rust using Actix Web v2 - Complete Tutorial](https://gill.net.in/posts/auth-microservice-rust-actix-web1.0-diesel-complete-tutorial/) -## Dependencies +### Dependencies On Ubuntu 19.10: diff --git a/forms/multipart-async-std/README.md b/forms/multipart-async-std/README.md index edaf171..6ad89cf 100644 --- a/forms/multipart-async-std/README.md +++ b/forms/multipart-async-std/README.md @@ -2,6 +2,11 @@ ### Run +```bash +cd forms/multipart-async-std +cargo run +``` + ``` open web browser to localhost:3000 and upload file(s) ``` ### Result diff --git a/forms/multipart-s3/README.md b/forms/multipart-s3/README.md index c33f72a..e501962 100644 --- a/forms/multipart-s3/README.md +++ b/forms/multipart-s3/README.md @@ -4,7 +4,7 @@ Receive multiple data in multipart form in JSON format and receive it as a struc # usage ``` -cd examples/multipart+s3 +cd forms/multipart-s3 ``` 1. copy .env.example .env 2. edit .env AWS_ACCESS_KEY_ID=you_key @@ -14,7 +14,7 @@ cd examples/multipart+s3 # Running Server ``` -cd examples/multipart+s3 +cd forms/multipart-s3 cargo run (or ``cargo watch -x run``) ``` http://localhost:3000 diff --git a/forms/multipart/README.md b/forms/multipart/README.md index edaf171..b685cd1 100644 --- a/forms/multipart/README.md +++ b/forms/multipart/README.md @@ -2,6 +2,11 @@ ### Run +```bash +cd forms/multipart +cargo run +``` + ``` open web browser to localhost:3000 and upload file(s) ``` ### Result diff --git a/graphql/graphql-demo/README.md b/graphql/graphql-demo/README.md index 067fbf8..7312a5c 100644 --- a/graphql/graphql-demo/README.md +++ b/graphql/graphql-demo/README.md @@ -3,6 +3,7 @@ Getting started using [Async-graphql](https://github.com/async-graphql/async-gra ## Run ```bash +cd graphql/graphql-demo cargo run --bin async-graphql-demo ``` diff --git a/graphql/juniper-advanced/README.md b/graphql/juniper-advanced/README.md index a41b1e7..26f4d27 100644 --- a/graphql/juniper-advanced/README.md +++ b/graphql/juniper-advanced/README.md @@ -17,12 +17,12 @@ Create ```.env``` file on the root directory of this project and set environment ```sh # go to the root dir -cd juniper-advanced - -# Run +cd graphql/juniper-advanced cargo run ``` ## GraphQL Playground - +``` +http://127.0.0.1:8080/graphiql +``` \ No newline at end of file diff --git a/graphql/juniper/README.md b/graphql/juniper/README.md index 0c25c46..7a7c0d7 100644 --- a/graphql/juniper/README.md +++ b/graphql/juniper/README.md @@ -10,7 +10,7 @@ If you want more advanced example, see also the [juniper-advanced example]. ### server ```bash -cd examples/graphql/juniper +cd graphql/juniper cargo run (or ``cargo watch -x run``) # Started http server: 127.0.0.1:8080 ``` diff --git a/json/json/README.md b/json/json/README.md index 0fb8cf4..3e6ee5d 100644 --- a/json/json/README.md +++ b/json/json/README.md @@ -7,7 +7,7 @@ Json's `Getting Started` guide using json (serde-json or json-rust) for Actix we ### server ```bash -cd examples/json +cd json/json cargo run # Started http server: 127.0.0.1:8080 ``` diff --git a/json/json_decode_error/README.md b/json/json_decode_error/README.md index e2b5c26..8abd605 100644 --- a/json/json_decode_error/README.md +++ b/json/json_decode_error/README.md @@ -9,7 +9,7 @@ representation of the error. ## Usage ```shell -cd examples/json_decode_error +cd json/json_decode_error cargo run # Started HTTP server: 127.0.0.1:8088 ``` diff --git a/json/jsonrpc/README.md b/json/jsonrpc/README.md index b9a4cea..997898f 100644 --- a/json/jsonrpc/README.md +++ b/json/jsonrpc/README.md @@ -3,7 +3,8 @@ A simple demo for building a `JSONRPC over HTTP` server in [actix-web](https://g # Server ```sh -$ cargo run +cd json/jsonrpc +cargo run # Starting server on 127.0.0.1:8080 ``` diff --git a/other/protobuf/README.md b/other/protobuf/README.md index a2e0c1b..6452efb 100644 --- a/other/protobuf/README.md +++ b/other/protobuf/README.md @@ -5,6 +5,7 @@ ### Server ```shell +cd other/protobuf # From workspace cargo run --bin protobuf-example diff --git a/other/server-sent-events/README.md b/other/server-sent-events/README.md index 804c5c9..219d2db 100644 --- a/other/server-sent-events/README.md +++ b/other/server-sent-events/README.md @@ -2,6 +2,7 @@ Example of server-sent events, aka `EventSource`, with actix web. ```sh +cd other/server-sent-events cargo run ``` @@ -14,7 +15,7 @@ curl localhost:8080/broadcast/my_message *my_message* should appear in the browser with a timestamp. ## Performance -This implementation serve thousand of clients on a 2013 macbook air without problems. +This implementation serve thousands of clients on a 2013 macbook air without problems. Run [benchmark.js](benchmark.js) to benchmark your own system: @@ -37,4 +38,4 @@ $ node drain.js Connections dropped: 5957, accepting connections: false^C⏎ ``` -_Accepting connections_ indicates wheter resources for the server have been exhausted. \ No newline at end of file +_Accepting connections_ indicates whether resources for the server have been exhausted. \ No newline at end of file diff --git a/other/udp-echo/README.md b/other/udp-echo/README.md index a72dd5d..e73e562 100644 --- a/other/udp-echo/README.md +++ b/other/udp-echo/README.md @@ -5,7 +5,7 @@ ### server ```bash -cd examples/udp-echo +cd other/udp-echo cargo run # Started http server: 127.0.0.1:12345 ``` diff --git a/other/unix-socket/README.md b/other/unix-socket/README.md index 9487032..065333f 100644 --- a/other/unix-socket/README.md +++ b/other/unix-socket/README.md @@ -1,7 +1,11 @@ ## Unix domain socket example ```bash -$ curl --unix-socket /tmp/actix-uds.socket http://localhost/ +cd other/unix-socket +cargo run + +# in another shell +curl --unix-socket /tmp/actix-uds.socket http://localhost/ Hello world! ``` @@ -10,5 +14,5 @@ according to the [documentation](https://actix.github.io/actix-web/actix_web/struct.HttpServer.html#method.bind_uds). And it does not delete the socket file (`/tmp/actix-uds.socket`) when stopping -the server so it will fail to start next time you run it unless you delete +the server, so it will fail to start next time you run it unless you delete the socket file manually. diff --git a/security/casbin/README.md b/security/casbin/README.md index 198042a..6a3897a 100644 --- a/security/casbin/README.md +++ b/security/casbin/README.md @@ -5,7 +5,7 @@ Basic integration of [Casbin-RS](https://github.com/casbin/casbin-rs) with [RBAC ## Usage ```sh -cd examples/casbin +cd security/casbin ``` Modify the files in the `rbac` directory and the code in the `src` directory as required. @@ -13,13 +13,13 @@ Modify the files in the `rbac` directory and the code in the `src` directory as ## Running Server ```sh -cd examples/casbin +cd security/casbin cargo run (or ``cargo watch -x run``) # Started http server: 127.0.0.1:8080 ``` -In this example, you can get the the successful result at `http://localhost:8080/success` (accessible) and the failed result at `http://localhost:8080/fail` (inaccessible, `ERR_EMPTY_RESPONSE`). +In this example, you can get the successful result at `http://localhost:8080/success` (accessible) and the failed result at `http://localhost:8080/fail` (inaccessible, `ERR_EMPTY_RESPONSE`). ## Others diff --git a/security/openssl/README.md b/security/openssl/README.md index 3426795..566f519 100644 --- a/security/openssl/README.md +++ b/security/openssl/README.md @@ -4,7 +4,7 @@ ### Certificate -We put the self-signed certificate in this direcotry as an example +We put the self-signed certificate in this directory as an example but your browser would complain that it isn't secure. So we recommend to use [`mkcert`] to trust it. To use local CA, you should run: @@ -23,7 +23,7 @@ mkcert 127.0.0.1 ### server ```bash -cd examples/openssl +cd security/openssl cargo run (or ``cargo watch -x run``) # Started http server: 127.0.0.1:8443 ``` diff --git a/security/rustls-client-cert/README.md b/security/rustls-client-cert/README.md index 21235c6..6eb9b74 100644 --- a/security/rustls-client-cert/README.md +++ b/security/rustls-client-cert/README.md @@ -10,7 +10,7 @@ generated by [`mkcert`] that was used to create the server and client certs. ### Server ```sh -cd examples/rustls-client-cert +cd security/rustls-client-cert cargo run ``` diff --git a/security/rustls/README.md b/security/rustls/README.md index 9d8ae94..8d9a277 100644 --- a/security/rustls/README.md +++ b/security/rustls/README.md @@ -30,7 +30,7 @@ let mut keys = rsa_private_keys(key_file).unwrap(); // rsa ```bash cd security/rustls -cargo run +cargo run # (or ``cargo watch -x run``) # Started http server: 127.0.0.1:8443 ``` diff --git a/security/web-cors/README.md b/security/web-cors/README.md index 4dd9f8d..788ac2b 100644 --- a/security/web-cors/README.md +++ b/security/web-cors/README.md @@ -2,14 +2,14 @@ ## Run Server ```sh -cd web-cors/backend +cd secutiy/web-cors/backend cargo run ``` ## Run Frontend In a separate terminal, also run: ```sh -cd web-cors/frontend +cd secutiy/web-cors/frontend npm install npm run serve ``` diff --git a/session/cookie-auth/README.md b/session/cookie-auth/README.md index 01bd321..119c138 100644 --- a/session/cookie-auth/README.md +++ b/session/cookie-auth/README.md @@ -1,5 +1,11 @@ # cookie-auth +```sh +cd session/cookie-auth +cargo run +# Starting http server: 127.0.0.1:8080 +``` + Testing with cookie auth with [curl](https://curl.haxx.se). Login: diff --git a/session/cookie-session/README.md b/session/cookie-session/README.md index 05e1251..86e12a9 100644 --- a/session/cookie-session/README.md +++ b/session/cookie-session/README.md @@ -1,7 +1,7 @@ ## Cookie session example ```sh -cd cookie-session +cd session/cookie-session cargo run # Starting http server: 127.0.0.1:8080 ``` diff --git a/session/redis-session/README.md b/session/redis-session/README.md index e69de29..299e720 100644 --- a/session/redis-session/README.md +++ b/session/redis-session/README.md @@ -0,0 +1,14 @@ +# redis-session + +```sh +cd session/redis-sessions +cargo run +# Starting http server: 127.0.0.1:8080 +``` + +## Available Routes + +- [GET /](http://localhost:8080/) +- [POST /do_something](http://localhost:8080/do_something) +- [POST /login](http://localhost:8080/login) +- [POST /logout](http://localhost:8080/logout) \ No newline at end of file diff --git a/template_engines/handlebars/README.md b/template_engines/handlebars/README.md index 9ee3e6a..e7061a6 100644 --- a/template_engines/handlebars/README.md +++ b/template_engines/handlebars/README.md @@ -2,6 +2,11 @@ This is an example of how to use Actix Web with the [Handlebars templating language](https://crates.io/crates/handlebars), which is currently the most popular crate that achieves this. After starting the server with `cargo run`, you may visit the following pages: +```bash +cd template_engines/handlebars +cargo run +``` + - http://localhost:8080 - http://localhost:8080/Emma/documents - http://localhost:8080/Bob/passwords diff --git a/template_engines/tera/README.md b/template_engines/tera/README.md index 12aa7a6..8efe4c3 100644 --- a/template_engines/tera/README.md +++ b/template_engines/tera/README.md @@ -7,7 +7,7 @@ Minimal example of using the template [tera](https://github.com/Keats/tera) that ### server ```bash -cd examples/template_tera +cd template_engines/tera cargo run (or ``cargo watch -x run``) # Started http server: 127.0.0.1:8080 ``` diff --git a/template_engines/tinytemplate/README.md b/template_engines/tinytemplate/README.md index d86b3a7..227e5f0 100644 --- a/template_engines/tinytemplate/README.md +++ b/template_engines/tinytemplate/README.md @@ -7,7 +7,7 @@ See the documentation for the minimalist template engine [tiny_template](https:/ ### Server ```bash -cd examples/template_tinytemplate +cd template_engines/tinytemplate cargo run # (or ``cargo watch -x run``) # Started http server: 127.0.0.1:8080 ``` diff --git a/template_engines/yarte/README.md b/template_engines/yarte/README.md index b629cfc..07c4117 100644 --- a/template_engines/yarte/README.md +++ b/template_engines/yarte/README.md @@ -3,8 +3,8 @@ Minimal example of using template [yarte](https://github.com/botika/yarte) that displays a form. ```bash +cd template_engines/yarte cargo test - cargo run ``` > open `localhost:8080` diff --git a/websockets/chat-broker/README.md b/websockets/chat-broker/README.md index 139d7eb..c720154 100644 --- a/websockets/chat-broker/README.md +++ b/websockets/chat-broker/README.md @@ -11,7 +11,7 @@ Differences: Possible Improvements: -* Could the Chat Server Actor be simultaneously a System Service (accessible to the Chat Session via the System Registry) and also run in a seperate thread? +* Could the Chat Server Actor be simultaneously a System Service (accessible to the Chat Session via the System Registry) and also run in a separate thread? ## Server