2 releases
0.0.2 | Mar 15, 2025 |
---|---|
0.0.1 | Mar 15, 2025 |
#910 in Parser implementations
256 downloads per month
88KB
2.5K
SLoC
氡-Rn
[氡-Rn] Rust Web开发脚手架,支持 salvo
和 axum
框架,并同时支持创建「单应用」和「多应用」
安装
cargo install rnx
特点
- ORM使用 sea-orm
- Redis使用 redis-rs
- 日志使用 tracing
- 配置使用 config-rs
- 命令行使用 clap
- 异步运行时使用 tokio
- 参数验证器使用 validator
- 包含 Trace、认证、请求日志、Panic捕获 中间价
- 简单好用的 API Result 统一输出方式
创建项目
单应用
rnx new --name=demo # salvo
rnx new --name=demo --axum # axum
.
├── Cargo.toml
├── Dockerfile
├── config.toml
└── src
├── app
│ ├── api
│ ├── cmd
│ ├── middleware
│ ├── router
│ ├── service
│ └── main.rs
└── internal
多应用
# http
rnx new --name=demo --app=foo --app=bar # salvo
rnx new --name=demo --app=foo --app=bar --axum # axum
.
├── Cargo.toml
├── foo.dockerfile
├── bar.dockerfile
├── foo_config.toml
├── bar_config.toml
└── src
├── app
│ ├── foo
│ │ ├── api
│ │ ├── cmd
│ │ ├── middleware
│ │ ├── router
│ │ ├── service
│ │ └── main.rs
│ ├── bar
│ │ ├── ...
│ │ └── main.rs
└── internal
创建应用
# 多应用项目适用,需在项目根目录执行(即:Cargo.toml所在目录)
rnx app --name=foo --name=bar # 创建salvo应用
rnx app --name=foo --name=bar --axum # 创建axum应用
.
├── Cargo.toml
├── foo.dockerfile
├── bar.dockerfile
├── foo_config.toml
├── bar_config.toml
└── src
├── app
│ ├── foo
│ │ ├── ...
│ │ └── main.rs
│ ├── bar
│ │ ├── ...
│ │ └── main.rs
└── internal
Enjoy 😊
Dependencies
~8–17MB
~217K SLoC