diff --git a/Cargo.lock b/Cargo.lock index 7540cea..555c8c7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5262,6 +5262,16 @@ dependencies = [ "env_logger", ] +[[package]] +name = "static-files" +version = "1.0.0" +dependencies = [ + "actix-files", + "actix-web", + "env_logger", + "log", +] + [[package]] name = "static_assertions" version = "0.3.4" @@ -5274,16 +5284,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" -[[package]] -name = "static_index" -version = "1.0.0" -dependencies = [ - "actix-files", - "actix-web", - "env_logger", - "log", -] - [[package]] name = "stdweb" version = "0.4.20" diff --git a/basics/basics/README.md b/basics/basics/README.md index a183798..b0f7176 100644 --- a/basics/basics/README.md +++ b/basics/basics/README.md @@ -4,7 +4,7 @@ ### server -```bash +```sh cd basics/basics cargo run # Started http server: 127.0.0.1:8080 @@ -18,4 +18,4 @@ cargo run - [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 \ No newline at end of file +- [http://localhost:8080/error](http://localhost:8080/error) Panic after request diff --git a/basics/nested-routing/README.md b/basics/nested-routing/README.md index 43ed4a1..3e387e9 100644 --- a/basics/nested-routing/README.md +++ b/basics/nested-routing/README.md @@ -3,7 +3,7 @@ The endpoints do nothing. ## Usage -```bash +```sh cd basics/nested-routing cargo run # Started http server: 127.0.0.1:8080 diff --git a/basics/state/README.md b/basics/state/README.md index f57edc0..fe79f0b 100644 --- a/basics/state/README.md +++ b/basics/state/README.md @@ -4,7 +4,7 @@ ### server -```bash +```sh cd basics/state cargo run # Started http server: 127.0.0.1:8080 diff --git a/basics/static-files/Cargo.toml b/basics/static-files/Cargo.toml index eee0661..4c4350f 100644 --- a/basics/static-files/Cargo.toml +++ b/basics/static-files/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "static_index" +name = "static-files" version = "1.0.0" edition = "2021" diff --git a/basics/static-files/README.md b/basics/static-files/README.md index 07214a2..874f54c 100644 --- a/basics/static-files/README.md +++ b/basics/static-files/README.md @@ -1,4 +1,4 @@ -# static_index +# Static Files Demonstrates how to serve static files. Inside the `./static` folder you will find 2 subfolders: @@ -8,13 +8,12 @@ Demonstrates how to serve static files. Inside the `./static` folder you will fi ## Usage -```bash -$ cd basics/static_index -$ cargo run +```sh +cd basics/static-files +cargo run ``` ### 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 737c384..2644482 100644 --- a/basics/todo/README.md +++ b/basics/todo/README.md @@ -10,7 +10,7 @@ A simple Todo project using a SQLite database. All instructions assume you have changed into this folder: -```bash +```sh cd basics/todo ``` diff --git a/databases/sqlite/README.md b/databases/sqlite/README.md index bb95b8a..675b763 100644 --- a/databases/sqlite/README.md +++ b/databases/sqlite/README.md @@ -5,7 +5,7 @@ Getting started using databases with Actix Web, asynchronously. ### init database sqlite From the root directory of this project: -```bash +```sh bash db/setup_db.sh ``` @@ -14,7 +14,7 @@ This creates a sqlite database, weather.db, in the root. ### server -```bash +```sh # if ubuntu : sudo apt-get install libsqlite3-dev # if fedora : sudo dnf install libsqlite3x-devel cargo run @@ -29,7 +29,7 @@ cargo run ### sqlite client -```bash +```sh # if ubuntu : sudo apt-get install sqlite3 # if fedora : sudo dnf install sqlite3x sqlite3 weather.db diff --git a/forms/form/README.md b/forms/form/README.md index 0a4bb5c..edb5257 100644 --- a/forms/form/README.md +++ b/forms/form/README.md @@ -1,8 +1,7 @@ ## Form example -```bash +```sh cd form cargo run # Started http server: 127.0.0.1:8080 ``` - diff --git a/forms/multipart/README.md b/forms/multipart/README.md index ffba927..edcd7d3 100644 --- a/forms/multipart/README.md +++ b/forms/multipart/README.md @@ -2,7 +2,7 @@ ### Run -```bash +```sh cd forms/multipart cargo run ``` diff --git a/graphql/async-graphql/README.md b/graphql/async-graphql/README.md index eda44b9..b910b1b 100644 --- a/graphql/async-graphql/README.md +++ b/graphql/async-graphql/README.md @@ -4,7 +4,7 @@ ## Usage -```bash +```sh cd graphql/graphql-demo cargo run ``` diff --git a/https-tls/openssl/README.md b/https-tls/openssl/README.md index 566f519..ab6eb8b 100644 --- a/https-tls/openssl/README.md +++ b/https-tls/openssl/README.md @@ -8,13 +8,13 @@ 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: -```bash +```sh mkcert -install ``` If you want to generate your own cert/private key file, then run: -```bash +```sh mkcert 127.0.0.1 ``` @@ -22,7 +22,7 @@ mkcert 127.0.0.1 ### server -```bash +```sh cd security/openssl cargo run (or ``cargo watch -x run``) # Started http server: 127.0.0.1:8443 diff --git a/https-tls/rustls/README.md b/https-tls/rustls/README.md index b1ec5ed..a9e1348 100644 --- a/https-tls/rustls/README.md +++ b/https-tls/rustls/README.md @@ -8,13 +8,13 @@ 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: -```bash +```sh mkcert -install ``` If you want to generate your own cert/private key file, then run: -```bash +```sh mkcert 127.0.0.1 localhost ``` @@ -28,7 +28,7 @@ let mut keys = rsa_private_keys(key_file).unwrap(); // rsa ### Running the Example Server -```bash +```sh cd security/rustls cargo run # (or ``cargo watch -x run``) # Started http server: 127.0.0.1:8443 diff --git a/json/json-validation/README.md b/json/json-validation/README.md index 4a92741..9e8e7e9 100644 --- a/json/json-validation/README.md +++ b/json/json-validation/README.md @@ -17,7 +17,7 @@ Actix Web features illustrated here include: ### server -```bash +```sh cd basics/json-validation cargo run # Started http server: 127.0.0.1:8080 diff --git a/json/json/README.md b/json/json/README.md index f83b755..13cb878 100644 --- a/json/json/README.md +++ b/json/json/README.md @@ -6,7 +6,7 @@ Json's `Getting Started` guide using json (serde-json or json-rust) for Actix We ### server -```bash +```sh cd json/json cargo run # Started http server: 127.0.0.1:8080 diff --git a/middleware/middleware-ext-mut/README.md b/middleware/middleware-ext-mut/README.md index b00bdbc..423bdd2 100644 --- a/middleware/middleware-ext-mut/README.md +++ b/middleware/middleware-ext-mut/README.md @@ -4,7 +4,7 @@ This example showcases a middleware that adds and retrieves request-local data. ## Usage -```bash +```sh cd middleware/middleware-ext-mut cargo run ``` diff --git a/middleware/middleware-http-to-https/README.md b/middleware/middleware-http-to-https/README.md index 3c0a3ca..7d94667 100644 --- a/middleware/middleware-http-to-https/README.md +++ b/middleware/middleware-http-to-https/README.md @@ -8,7 +8,7 @@ Now, the only problem left to solve is, to listen to **HTTP** connections as wel ## Usage -```bash +```sh cd middleware/middleware-http-to-https cargo run ``` diff --git a/middleware/middleware/README.md b/middleware/middleware/README.md index 646e7f8..1cbf83e 100644 --- a/middleware/middleware/README.md +++ b/middleware/middleware/README.md @@ -4,7 +4,7 @@ This example showcases a bunch of different uses of middleware. See also the [Mi ## Usage -```bash +```sh cd basics/middleware cargo run # Started http server: 127.0.0.1:8080 diff --git a/shutdown-server/README.md b/shutdown-server/README.md index 0b5ea1d..f56076d 100644 --- a/shutdown-server/README.md +++ b/shutdown-server/README.md @@ -11,7 +11,7 @@ Demonstrates how to shutdown the web server in a couple of ways: ### Running The Server -```bash +```sh cd basics/shutdown-server cargo run --bin shutdown-server diff --git a/templating/handlebars/README.md b/templating/handlebars/README.md index d097a57..4470bba 100644 --- a/templating/handlebars/README.md +++ b/templating/handlebars/README.md @@ -4,7 +4,7 @@ This is an example of how to use Actix Web with the [Handlebars](https://crates. ## Usage -```bash +```sh cd templating/handlebars cargo run ``` diff --git a/templating/sailfish/README.md b/templating/sailfish/README.md index 25f2989..9fdbbaf 100644 --- a/templating/sailfish/README.md +++ b/templating/sailfish/README.md @@ -4,7 +4,7 @@ This is an example of how to use Actix Web with the [Sailfish](https://sailfish. ## Usage -```bash +```sh cd templating/sailfish cargo run ``` diff --git a/templating/tera/README.md b/templating/tera/README.md index 34c7896..f877e04 100644 --- a/templating/tera/README.md +++ b/templating/tera/README.md @@ -6,7 +6,7 @@ Minimal example of using the template [tera](https://github.com/Keats/tera) that ### server -```bash +```sh cd templating/tera cargo run (or ``cargo watch -x run``) # Started http server: 127.0.0.1:8080 diff --git a/templating/tinytemplate/README.md b/templating/tinytemplate/README.md index e0c8e78..b01da72 100644 --- a/templating/tinytemplate/README.md +++ b/templating/tinytemplate/README.md @@ -6,7 +6,7 @@ See the documentation for the minimalist template engine [tiny_template](https:/ ### Server -```bash +```sh cd templating/tinytemplate cargo run # (or ``cargo watch -x run``) # Started http server: 127.0.0.1:8080 diff --git a/templating/yarte/README.md b/templating/yarte/README.md index 08ea39f..68e91dd 100644 --- a/templating/yarte/README.md +++ b/templating/yarte/README.md @@ -2,7 +2,7 @@ Minimal example of using template [yarte](https://github.com/botika/yarte) that displays a form. -```bash +```sh cd templating/yarte cargo test cargo run diff --git a/unix-socket/README.md b/unix-socket/README.md index ea3ce3d..19937de 100644 --- a/unix-socket/README.md +++ b/unix-socket/README.md @@ -1,6 +1,6 @@ ## Unix domain socket example -```bash +```sh cd unix-socket cargo run diff --git a/websockets/autobahn/README.md b/websockets/autobahn/README.md index b991fdf..73843b9 100644 --- a/websockets/autobahn/README.md +++ b/websockets/autobahn/README.md @@ -6,7 +6,7 @@ WebSocket server for the [Autobahn WebSocket protocol testsuite](https://github. ### Server -```bash +```sh cd websockets/autobahn cargo run ``` @@ -17,7 +17,7 @@ Running the autobahn test suite is easiest using the docker image as explained o After starting the server, in the same directory, run the test suite in "fuzzing client" mode: -```bash +```sh docker run -it --rm \ -v "${PWD}/config:/config" \ -v "${PWD}/reports:/reports" \ diff --git a/websockets/chat-tcp/README.md b/websockets/chat-tcp/README.md index 0712597..79e19cf 100644 --- a/websockets/chat-tcp/README.md +++ b/websockets/chat-tcp/README.md @@ -5,19 +5,19 @@ This is extension of the Added features: -* Browser WebSocket client -* Chat server runs in separate thread -* Tcp listener runs in separate thread +- Browser WebSocket client +- Chat server runs in separate thread +- TCP listener runs in separate thread ## Server Chat server listens for incoming tcp connections. Server can access several types of message: -* `/list` - list all available rooms -* `/join name` - join room, if room does not exist, create new one -* `/name name` - set session name -* `some message` - just string, send message to all peers in same room -* client has to send heartbeat `Ping` messages, if server does not receive a heartbeat message for 10 seconds connection gets dropped +- `/list` - list all available rooms +- `/join name` - join room, if room does not exist, create new one +- `/name name` - set session name +- `some message` - just string, send message to all peers in same room +- client has to send heartbeat `Ping` messages, if server does not receive a heartbeat message for 10 seconds connection gets dropped To start server use command: `cargo run --bin websocket-tcp-server` @@ -29,4 +29,4 @@ To run client use command: `cargo run --bin websocket-tcp-client` ## WebSocket Browser Client -Open url: [http://localhost:8080/](http://localhost:8080/) +Open url: diff --git a/websockets/echo/README.md b/websockets/echo/README.md index c31ac89..b69a005 100644 --- a/websockets/echo/README.md +++ b/websockets/echo/README.md @@ -6,7 +6,7 @@ Simple echo websocket server. ### server -```bash +```sh cd websockets/websocket cargo run --bin websocket-server # Started http server: 127.0.0.1:8080 @@ -18,7 +18,7 @@ cargo run --bin websocket-server ### rust client -```bash +```sh cd websockets/websocket cargo run --bin websocket-client ```