#yew #yew-router #服务器 #index-file #文件服务

bin+lib syserve

适用于 yew 和 yew-router 应用的简单服务器

4 个版本 (2 个重大更新)

0.3.0 2021 年 4 月 21 日
0.2.1 2021 年 3 月 11 日
0.2.0 2021 年 3 月 11 日
0.1.0 2021 年 3 月 8 日

#811HTTP 服务器

MIT/Apache

41KB
774 代码行

syserve

Crates.io Crates.io

Simple Yew Server.

灵感来自 devserverRust 书籍 的最终项目,作为一个简单、最小化的针对 yew 和 yew 路由应用的开发服务器。

此 crate 不使用任何大型服务器库,如 actix 或 rocket,而是使用 std::net 以及 httparsethreadpool 库编写。Syserve 旨在成为一个最小但功能丰富的开发服务器,具有 HTTPS 支持(预期)和文件服务的自定义。

此工具不应用于生产环境。

安装

$ cargo install syserve

应在不到一分钟内完成安装。

用法

$ syserve -h
Usage:
  syserve [OPTIONS]

Minimal server for yew and yew-router apps

Optional arguments:
  -h,--help             Show this help message and exit
  -d,--dir DIR          Directory to serve (must contain index.html). Default: current directory
  -i,--index INDEX      Index file to be served. Default: index.html
  -n,--404,--not-found NOT_FOUND
                        File to be served in case of 404
  -a,--addr ADDR        Address at which files are served. Default: localhost
  -p,--port PORT        Port at which files are served. Default: 7878

示例

$ syserve -d /path/to/dist/dir

其中 dist/ 目录包含一个 index.html 文件,该文件加载 WASM 文件。在 https://127.0.0.1:7878 上提供服务

依赖项

~3–12MB
~119K SLoC