Crates.io | ryde_static_files |
lib.rs | ryde_static_files |
version | 0.1.0 |
source | src |
created_at | 2024-02-29 17:34:41.561535 |
updated_at | 2024-02-29 17:34:41.561535 |
description | static files crate for ryde |
homepage | https://github.com/swlkr/ryde |
repository | https://github.com/swlkr/ryde |
max_upload_size | |
id | 1158018 |
size | 2,070 |
Static files provides an easy way to declare and embed your static files.
This will embed the static files in your binary at compile time with include_bytes!
.
It will try to find the files starting from the root of your project: CARGO_MANIFEST_DIR
.
use ryde::*;
#[main]
async fn main() {
serve!("localhost:3000", Routes)
}
#[router]
enum Routes {
#[embed("/static/*file")]
StaticFiles
}
fn render() -> String {
ryde::render((
doctype(),
html((
head(render!(StaticFiles)),
body(),
)),
))
}