mirror of
https://github.com/actix/examples
synced 2025-06-26 17:17:42 +02:00
fix broken links (#441)
Co-authored-by: Igor Aleksanov <popzxc@yandex.ru> Co-authored-by: Altug Sahin <altugsahin@gmail.com> Co-authored-by: Rob Ede <robjtede@icloud.com>
This commit is contained in:
@ -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
|
@ -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```
|
||||
|
@ -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
|
||||
```
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
@ -5,7 +5,7 @@
|
||||
### server
|
||||
|
||||
```bash
|
||||
cd examples/state
|
||||
cd basics/state
|
||||
cargo run
|
||||
# Started http server: 127.0.0.1:8080
|
||||
```
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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
|
||||
|
Reference in New Issue
Block a user