-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,11 +7,33 @@ and this project adheres to [Semantic Versioning]. | |
|
||
# Unreleased | ||
|
||
- **breaking:** `SpaRouter::handle_error` has been removed ([#1783]) | ||
- **breaking:** `SpaRouter` has been removed. Use `ServeDir` and `ServeFile` | ||
from `tower-http` instead: | ||
|
||
```rust | ||
// before | ||
Router::new().merge(SpaRouter::new("/assets", "dist")); | ||
|
||
// with ServeDir | ||
Router::new().nest_service("/assets", ServeDir::new("dist")); | ||
|
||
// before with `index_file` | ||
Router::new().merge(SpaRouter::new("/assets", "dist").index_file("index.html")); | ||
|
||
// with ServeDir + ServeFile | ||
Router::new().nest_service( | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
davidpdrsn
Author
Member
|
||
"/assets", | ||
ServeDir::new("dist").not_found_service(ServeFile::new("dist/index.html")), | ||
); | ||
``` | ||
|
||
See the [static-file-server-example] for more examples. | ||
|
||
- **breaking:** Change casing of `ProtoBuf` to `Protobuf` ([#1595]) | ||
|
||
[#1783]: https://github.com/tokio-rs/axum/pull/1783 | ||
[#1595]: https://github.com/tokio-rs/axum/pull/1595 | ||
[static-file-server-example]: https://github.com/tokio-rs/axum/blob/main/examples/static-file-server/src/main.rs | ||
|
||
# 0.5.0 (12. February, 2022) | ||
|
||
|
This file was deleted.
Something that wasnt clear here about how this works is that dist/index.html will be served from the router if say "/hello" isn't found. It's almost like the server dir and the "not found" are kind of seperate in concept, but they are merged in the way they are presented to the router. Is there a way to improve the docs here?
because the way that I first read this it seemed like only if a url under /dist/ was not found, then dist/index would be served.