actori-web-static-files-0.3.0 doesn't have any documentation.
actori-web static files as resources support
Legal
Dual-licensed under MIT
or the UNLICENSE.
Features
- Embed static resources in end binary
- Serve static resources as directory in
actori-web
- Install package manager (npm) dependincies
Usage
Use-case #1: Static resources folder
Create folder with static resources in your project (for example static
):
Add to Cargo.toml
dependency to actori-web-static-files
:
[]
= "0.3"
[]
= "0.3"
Add build script to Cargo.toml
:
[]
= "build.rs"
Add build.rs
with call to bundle resources:
use resource_dir;
Include generated code in main.rs
:
use ;
use actori_web_static_files;
use HashMap;
include!;
async
Run the server:
Request the resource:
> GET
> Host:
> User-Agent:
>
< HTTP/1.1
< content-length:
< date:
<
) )
Use-case #2: package.json - npm managed folder
Create folder with static resources in your project (for example static
):
# install your npm dependencies (here we use fontawesome as an example)
Add generated folder to ignore file of your version control system (here: git):
Add dependencies
and build-dependencies
in Cargo.toml
same way as in the first use-case.
Add build.rs
with call to bundle resources:
use npm_resource_dir;
Include generated code in main.rs
same way as in the first use-case.
Reference resources in your HTML
:
Hi