mirror of
https://github.com/actix/examples
synced 2024-11-23 22:41:07 +01:00
fix static-files readme name
This commit is contained in:
parent
d25d71111f
commit
1206905a11
20
Cargo.lock
generated
20
Cargo.lock
generated
@ -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"
|
||||
|
@ -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
|
||||
- [http://localhost:8080/error](http://localhost:8080/error) Panic after request
|
||||
|
@ -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
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
### server
|
||||
|
||||
```bash
|
||||
```sh
|
||||
cd basics/state
|
||||
cargo run
|
||||
# Started http server: 127.0.0.1:8080
|
||||
|
@ -1,5 +1,5 @@
|
||||
[package]
|
||||
name = "static_index"
|
||||
name = "static-files"
|
||||
version = "1.0.0"
|
||||
edition = "2021"
|
||||
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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
|
||||
```
|
||||
|
||||
|
@ -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
|
||||
|
@ -1,8 +1,7 @@
|
||||
## Form example
|
||||
|
||||
```bash
|
||||
```sh
|
||||
cd form
|
||||
cargo run
|
||||
# Started http server: 127.0.0.1:8080
|
||||
```
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
### Run
|
||||
|
||||
```bash
|
||||
```sh
|
||||
cd forms/multipart
|
||||
cargo run
|
||||
```
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
## Usage
|
||||
|
||||
```bash
|
||||
```sh
|
||||
cd graphql/graphql-demo
|
||||
cargo run
|
||||
```
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
```
|
||||
|
@ -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
|
||||
```
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
```
|
||||
|
@ -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
|
||||
```
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -1,6 +1,6 @@
|
||||
## Unix domain socket example
|
||||
|
||||
```bash
|
||||
```sh
|
||||
cd unix-socket
|
||||
cargo run
|
||||
|
||||
|
@ -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" \
|
||||
|
@ -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: <http://localhost:8080>
|
||||
|
@ -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
|
||||
```
|
||||
|
Loading…
Reference in New Issue
Block a user