axum/examples
Nick Ashley 007a0e85f2
Use 308 instead of 301 for trailing slash redirects (#682)
* Use 308 status instead of 301 when redirecting

For redirects resulting from requests to paths with a trailing slash,
use 308 instead of 301 to prevent non-GET requests (POST, PUT, etc) from
being changed to GET.

For example, (assuming a route for /path is defined)...
  - Old behavior results in:
  POST /path/ -> GET /path

  - New behavior results in:
  POST /path/ -> POST /path

Fixes #681

* Add deprecation notice to found()

Deprecates found() due to its use of HTTP 302

* rustfmt

* Use dedicated redirect method

Use Redirect::permanent instead of re-implementing its functionality

* Remove deprecated method from example

Replace usages of Redirect:found with Redirect::to and Redirect::temporary as appropriate

* Fix panic in oauth example

Previously the example would panic if a request was made without the
`Cookie` header. Now the user is redirected to the login page as
expected.

* Update CHANGELOG

* Revert pub TypedheaderRejection fields

* Fix clippy lint

* cargo fmt

* Fix CHANGELOG link

* Adhere to implicit line length limit
2022-01-12 15:14:06 +01:00
..
async-graphql Fix misc warnings from CI (#620) 2021-12-12 17:21:29 +01:00
chat Update tracing-subscriber to 0.3 (#472) 2021-11-06 14:50:23 +00:00
cors Update tower-http (#581) 2021-12-01 20:14:25 +00:00
customize-extractor-error Move FromRequest and IntoResponse into new axum-core crate (#564) 2021-11-30 13:46:13 +00:00
customize-path-rejection Provide more data in Path deserialization error (#574) 2021-12-02 08:51:29 +01:00
error-handling-and-dependency-injection Introduce Response type alias as a shorthand for Response<BoxBody> (#590) 2021-12-05 19:16:46 +01:00
form Update tracing-subscriber to 0.3 (#472) 2021-11-06 14:50:23 +00:00
global-404-handler Update tracing-subscriber to 0.3 (#472) 2021-11-06 14:50:23 +00:00
graceful-shutdown Simplify graceful shutdown (#673) 2021-12-28 16:23:07 +01:00
hello-world Move axum crate into workspace subfolder (#458) 2021-11-03 12:38:48 +01:00
http-proxy Introduce Response type alias as a shorthand for Response<BoxBody> (#590) 2021-12-05 19:16:46 +01:00
jwt A few small refactorings (#655) 2021-12-27 14:02:38 +01:00
key-value-store Update tower-http (#581) 2021-12-01 20:14:25 +00:00
low-level-rustls Update tracing-subscriber to 0.3 (#472) 2021-11-06 14:50:23 +00:00
multipart-form Update tower-http (#581) 2021-12-01 20:14:25 +00:00
oauth Use 308 instead of 301 for trailing slash redirects (#682) 2022-01-12 15:14:06 +01:00
print-request-response Add middleware::from_fn for creating middleware from async fns (#656) 2021-12-27 14:01:26 +01:00
prometheus-metrics Add metrics example (#671) 2021-12-28 15:58:48 +01:00
query-params-with-empty-strings FromStr based empty_string_as_none implementation (#486) 2021-11-09 13:05:31 +01:00
readme Update tracing-subscriber to 0.3 (#472) 2021-11-06 14:50:23 +00:00
reverse-proxy Update tracing-subscriber to 0.3 (#472) 2021-11-06 14:50:23 +00:00
routes-and-handlers-close-together Example for defining routes and handlers close together (#621) 2021-12-12 23:54:18 +01:00
sessions Fix session cookie example (#638) 2021-12-22 15:27:13 +01:00
sse Add SSE tests (#652) 2022-01-03 18:48:50 +01:00
static-file-server Update tower-http (#581) 2021-12-01 20:14:25 +00:00
templates Introduce Response type alias as a shorthand for Response<BoxBody> (#590) 2021-12-05 19:16:46 +01:00
testing Update tower-http (#581) 2021-12-01 20:14:25 +00:00
tls-rustls update tls-rustls example (#494) 2021-11-10 15:07:09 +01:00
todos Update tower-http (#581) 2021-12-01 20:14:25 +00:00
tokio-postgres Update tracing-subscriber to 0.3 (#472) 2021-11-06 14:50:23 +00:00
tracing-aka-logging Introduce Response type alias as a shorthand for Response<BoxBody> (#590) 2021-12-05 19:16:46 +01:00
unix-domain-socket Use nightly clippy & rustfmt for more style checks (#487) 2021-11-09 11:53:57 +00:00
validator Fix misc warnings from CI (#620) 2021-12-12 17:21:29 +01:00
versioning Introduce Response type alias as a shorthand for Response<BoxBody> (#590) 2021-12-05 19:16:46 +01:00
websockets Update tower-http (#581) 2021-12-01 20:14:25 +00:00
README.md Restructure community showcase (#454) 2021-11-03 09:20:01 +01:00

Examples

This folder contains numerous example showing how to use axum. Each example is setup as its own crate so its dependencies are clear.

For a list of what the community built with axum, please see the list here.