~repos /rust-embed
git clone https://pyrossh.dev/repos/rust-embed.git
rust macro which loads files into the rust binary at compile time during release and loads the file from the fs during dev.
65d00423
—
frederikhors 3 years ago
use Response
examples/axum-spa/main.rs
CHANGED
|
@@ -26,7 +26,7 @@ async fn main() {
|
|
|
26
26
|
.unwrap();
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
async fn static_handler(uri: Uri) ->
|
|
29
|
+
async fn static_handler(uri: Uri) -> Response {
|
|
30
30
|
let path = uri.path().trim_start_matches('/');
|
|
31
31
|
|
|
32
32
|
if path.is_empty() || path == INDEX_HTML {
|
|
@@ -53,7 +53,7 @@ async fn static_handler(uri: Uri) -> impl IntoResponse {
|
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
async fn index_html() ->
|
|
56
|
+
async fn index_html() -> Response {
|
|
57
57
|
match Assets::get(INDEX_HTML) {
|
|
58
58
|
Some(content) => {
|
|
59
59
|
let body = boxed(Full::from(content.data));
|