4个版本
0.2.6 | 2024年4月9日 |
---|---|
0.2.2 | 2023年7月20日 |
0.2.0 | 2023年7月12日 |
0.1.0 | 2023年7月12日 |
#105 in HTTP服务器
每月24次下载
12KB
134 行
Rustatic - Rust静态服务器
当本地开发静态网站时,能够运行一个小型Web服务器并查看结果非常有用。
Rustatic提供这项服务。
安装
公众
然后运行
rustatic
或使用更多参数运行
rustatic --indexfile index.html --nice --host 127.0.0.1 --port 5000 --path /path/to/html
每个命令行参数都有一个默认值
--path
默认为当前目录--host
默认为127.0.0.1--port
默认为5000--indexfile
默认为无。如果提供,则访问目录将返回此文件的内容。通常人们有--indexfile index.html
。--nice
以.html扩展名服务器.html文件。如果用户访问/path/page
,rustatic将返回/path/page.html
文件。
Rust用户
- 如果您已安装Rust,可以使用以下命令安装
rustatic
cargo install rustatic
- 然后您可以运行
rustatic --help
rustatic --version
rustatic --path /path/to/html --host 127.0.0.1 --port 5000
开发者
如果您想帮助开发rustatic
,您可以克隆仓库并运行程序而无需进一步安装
git clone https://github.com/szabgab/rustatic
cd rustatic
然后您可以像这样运行命令
cargo run -- --help
cargo run -- --version
cargo run -- --indexfile index.html --nice --host 127.0.0.1 --port 5000 --path /path/to/html
发布和发布
- 在Cargo.toml和下面的注释中更新版本号。
- git add .
- git commit -m "更新版本到v0.2.6"
- git tag -a v0.2.6 -m "发布版本v0.2.6"
- git push --tags
- cargo publish
待办事项
- 创建可下载的可执行文件,无需从仓库克隆
- 处理代码中的待办事项。
依赖关系
~1.7–2.4MB
~47K SLoC