1
0
mirror of https://github.com/actix/examples synced 2024-11-23 14:31:07 +01:00

fix static-files readme name

This commit is contained in:
Rob Ede 2022-02-18 03:36:04 +00:00
parent d25d71111f
commit 1206905a11
No known key found for this signature in database
GPG Key ID: 97C636207D3EF933
28 changed files with 57 additions and 59 deletions

20
Cargo.lock generated
View File

@ -5262,6 +5262,16 @@ dependencies = [
"env_logger", "env_logger",
] ]
[[package]]
name = "static-files"
version = "1.0.0"
dependencies = [
"actix-files",
"actix-web",
"env_logger",
"log",
]
[[package]] [[package]]
name = "static_assertions" name = "static_assertions"
version = "0.3.4" version = "0.3.4"
@ -5274,16 +5284,6 @@ version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
[[package]]
name = "static_index"
version = "1.0.0"
dependencies = [
"actix-files",
"actix-web",
"env_logger",
"log",
]
[[package]] [[package]]
name = "stdweb" name = "stdweb"
version = "0.4.20" version = "0.4.20"

View File

@ -4,7 +4,7 @@
### server ### server
```bash ```sh
cd basics/basics cd basics/basics
cargo run cargo run
# Started http server: 127.0.0.1:8080 # 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/favicon](http://localhost:8080/favicon)
- [http://localhost:8080/welcome](http://localhost:8080/static/welcome.html) - [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/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

View File

@ -3,7 +3,7 @@ The endpoints do nothing.
## Usage ## Usage
```bash ```sh
cd basics/nested-routing cd basics/nested-routing
cargo run cargo run
# Started http server: 127.0.0.1:8080 # Started http server: 127.0.0.1:8080

View File

@ -4,7 +4,7 @@
### server ### server
```bash ```sh
cd basics/state cd basics/state
cargo run cargo run
# Started http server: 127.0.0.1:8080 # Started http server: 127.0.0.1:8080

View File

@ -1,5 +1,5 @@
[package] [package]
name = "static_index" name = "static-files"
version = "1.0.0" version = "1.0.0"
edition = "2021" edition = "2021"

View File

@ -1,4 +1,4 @@
# static_index # Static Files
Demonstrates how to serve static files. Inside the `./static` folder you will find 2 subfolders: 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 ## Usage
```bash ```sh
$ cd basics/static_index cd basics/static-files
$ cargo run cargo run
``` ```
### Available Routes ### Available Routes
- [GET /](http://localhost:8080/) - [GET /](http://localhost:8080/)
- [GET /images](http://localhost:8080/images) - [GET /images](http://localhost:8080/images)

View File

@ -10,7 +10,7 @@ A simple Todo project using a SQLite database.
All instructions assume you have changed into this folder: All instructions assume you have changed into this folder:
```bash ```sh
cd basics/todo cd basics/todo
``` ```

View File

@ -5,7 +5,7 @@ Getting started using databases with Actix Web, asynchronously.
### init database sqlite ### init database sqlite
From the root directory of this project: From the root directory of this project:
```bash ```sh
bash db/setup_db.sh bash db/setup_db.sh
``` ```
@ -14,7 +14,7 @@ This creates a sqlite database, weather.db, in the root.
### server ### server
```bash ```sh
# if ubuntu : sudo apt-get install libsqlite3-dev # if ubuntu : sudo apt-get install libsqlite3-dev
# if fedora : sudo dnf install libsqlite3x-devel # if fedora : sudo dnf install libsqlite3x-devel
cargo run cargo run
@ -29,7 +29,7 @@ cargo run
### sqlite client ### sqlite client
```bash ```sh
# if ubuntu : sudo apt-get install sqlite3 # if ubuntu : sudo apt-get install sqlite3
# if fedora : sudo dnf install sqlite3x # if fedora : sudo dnf install sqlite3x
sqlite3 weather.db sqlite3 weather.db

View File

@ -1,8 +1,7 @@
## Form example ## Form example
```bash ```sh
cd form cd form
cargo run cargo run
# Started http server: 127.0.0.1:8080 # Started http server: 127.0.0.1:8080
``` ```

View File

@ -2,7 +2,7 @@
### Run ### Run
```bash ```sh
cd forms/multipart cd forms/multipart
cargo run cargo run
``` ```

View File

@ -4,7 +4,7 @@
## Usage ## Usage
```bash ```sh
cd graphql/graphql-demo cd graphql/graphql-demo
cargo run cargo run
``` ```

View File

@ -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. 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: So we recommend to use [`mkcert`] to trust it. To use local CA, you should run:
```bash ```sh
mkcert -install mkcert -install
``` ```
If you want to generate your own cert/private key file, then run: If you want to generate your own cert/private key file, then run:
```bash ```sh
mkcert 127.0.0.1 mkcert 127.0.0.1
``` ```
@ -22,7 +22,7 @@ mkcert 127.0.0.1
### server ### server
```bash ```sh
cd security/openssl cd security/openssl
cargo run (or ``cargo watch -x run``) cargo run (or ``cargo watch -x run``)
# Started http server: 127.0.0.1:8443 # Started http server: 127.0.0.1:8443

View File

@ -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. 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: So we recommend to use [`mkcert`] to trust it. To use local CA, you should run:
```bash ```sh
mkcert -install mkcert -install
``` ```
If you want to generate your own cert/private key file, then run: If you want to generate your own cert/private key file, then run:
```bash ```sh
mkcert 127.0.0.1 localhost mkcert 127.0.0.1 localhost
``` ```
@ -28,7 +28,7 @@ let mut keys = rsa_private_keys(key_file).unwrap(); // rsa
### Running the Example Server ### Running the Example Server
```bash ```sh
cd security/rustls cd security/rustls
cargo run # (or ``cargo watch -x run``) cargo run # (or ``cargo watch -x run``)
# Started http server: 127.0.0.1:8443 # Started http server: 127.0.0.1:8443

View File

@ -17,7 +17,7 @@ Actix Web features illustrated here include:
### server ### server
```bash ```sh
cd basics/json-validation cd basics/json-validation
cargo run cargo run
# Started http server: 127.0.0.1:8080 # Started http server: 127.0.0.1:8080

View File

@ -6,7 +6,7 @@ Json's `Getting Started` guide using json (serde-json or json-rust) for Actix We
### server ### server
```bash ```sh
cd json/json cd json/json
cargo run cargo run
# Started http server: 127.0.0.1:8080 # Started http server: 127.0.0.1:8080

View File

@ -4,7 +4,7 @@ This example showcases a middleware that adds and retrieves request-local data.
## Usage ## Usage
```bash ```sh
cd middleware/middleware-ext-mut cd middleware/middleware-ext-mut
cargo run cargo run
``` ```

View File

@ -8,7 +8,7 @@ Now, the only problem left to solve is, to listen to **HTTP** connections as wel
## Usage ## Usage
```bash ```sh
cd middleware/middleware-http-to-https cd middleware/middleware-http-to-https
cargo run cargo run
``` ```

View File

@ -4,7 +4,7 @@ This example showcases a bunch of different uses of middleware. See also the [Mi
## Usage ## Usage
```bash ```sh
cd basics/middleware cd basics/middleware
cargo run cargo run
# Started http server: 127.0.0.1:8080 # Started http server: 127.0.0.1:8080

View File

@ -11,7 +11,7 @@ Demonstrates how to shutdown the web server in a couple of ways:
### Running The Server ### Running The Server
```bash ```sh
cd basics/shutdown-server cd basics/shutdown-server
cargo run --bin shutdown-server cargo run --bin shutdown-server

View File

@ -4,7 +4,7 @@ This is an example of how to use Actix Web with the [Handlebars](https://crates.
## Usage ## Usage
```bash ```sh
cd templating/handlebars cd templating/handlebars
cargo run cargo run
``` ```

View File

@ -4,7 +4,7 @@ This is an example of how to use Actix Web with the [Sailfish](https://sailfish.
## Usage ## Usage
```bash ```sh
cd templating/sailfish cd templating/sailfish
cargo run cargo run
``` ```

View File

@ -6,7 +6,7 @@ Minimal example of using the template [tera](https://github.com/Keats/tera) that
### server ### server
```bash ```sh
cd templating/tera cd templating/tera
cargo run (or ``cargo watch -x run``) cargo run (or ``cargo watch -x run``)
# Started http server: 127.0.0.1:8080 # Started http server: 127.0.0.1:8080

View File

@ -6,7 +6,7 @@ See the documentation for the minimalist template engine [tiny_template](https:/
### Server ### Server
```bash ```sh
cd templating/tinytemplate cd templating/tinytemplate
cargo run # (or ``cargo watch -x run``) cargo run # (or ``cargo watch -x run``)
# Started http server: 127.0.0.1:8080 # Started http server: 127.0.0.1:8080

View File

@ -2,7 +2,7 @@
Minimal example of using template [yarte](https://github.com/botika/yarte) that displays a form. Minimal example of using template [yarte](https://github.com/botika/yarte) that displays a form.
```bash ```sh
cd templating/yarte cd templating/yarte
cargo test cargo test
cargo run cargo run

View File

@ -1,6 +1,6 @@
## Unix domain socket example ## Unix domain socket example
```bash ```sh
cd unix-socket cd unix-socket
cargo run cargo run

View File

@ -6,7 +6,7 @@ WebSocket server for the [Autobahn WebSocket protocol testsuite](https://github.
### Server ### Server
```bash ```sh
cd websockets/autobahn cd websockets/autobahn
cargo run 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: After starting the server, in the same directory, run the test suite in "fuzzing client" mode:
```bash ```sh
docker run -it --rm \ docker run -it --rm \
-v "${PWD}/config:/config" \ -v "${PWD}/config:/config" \
-v "${PWD}/reports:/reports" \ -v "${PWD}/reports:/reports" \

View File

@ -5,19 +5,19 @@ This is extension of the
Added features: Added features:
* Browser WebSocket client - Browser WebSocket client
* Chat server runs in separate thread - Chat server runs in separate thread
* Tcp listener runs in separate thread - TCP listener runs in separate thread
## Server ## Server
Chat server listens for incoming tcp connections. Server can access several types of message: Chat server listens for incoming tcp connections. Server can access several types of message:
* `/list` - list all available rooms - `/list` - list all available rooms
* `/join name` - join room, if room does not exist, create new one - `/join name` - join room, if room does not exist, create new one
* `/name name` - set session name - `/name name` - set session name
* `some message` - just string, send message to all peers in same room - `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 - 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` 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 ## WebSocket Browser Client
Open url: [http://localhost:8080/](http://localhost:8080/) Open url: <http://localhost:8080>

View File

@ -6,7 +6,7 @@ Simple echo websocket server.
### server ### server
```bash ```sh
cd websockets/websocket cd websockets/websocket
cargo run --bin websocket-server cargo run --bin websocket-server
# Started http server: 127.0.0.1:8080 # Started http server: 127.0.0.1:8080
@ -18,7 +18,7 @@ cargo run --bin websocket-server
### rust client ### rust client
```bash ```sh
cd websockets/websocket cd websockets/websocket
cargo run --bin websocket-client cargo run --bin websocket-client
``` ```