use_static_files

Macro use_static_files 

Source
macro_rules! use_static_files {
    (
        $router:path
    ) => { ... };
}
Expand description

The main way to load the static files as ready-to-use routes in the application.

This ensures every file is accessible through HTTP GET requests by adding all of them to the router automatically.

ยงExample

The best way to use this macro is to include it in the bootstraping step for the router:

#[post_upgrade]
fn post_upgrade() {
    ROUTER.with(|r| {
        let mut instance = controller::setup();
        pluto::use_static_files!(instance);
        *r.borrow_mut() = instance;
    })
}