This repository has been archived on 2025-04-22. You can view files and clone it, but cannot push or open issues or pull requests.
rust-demo/README.md

31 lines
776 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

## Rust分层架构
1. 表示层Presentation Layer负责处理 HTTP 请求和响应,通常包含路由和控制器。
2. 业务逻辑层Business Logic Layer包含服务和业务逻辑实现核心应用功能。
3. 数据访问层Data Access Layer与数据库或其他存储系统进行交互。
4. 模型层Model Layer定义应用程序的数据结构。
```angular2html
src/
|-- main.rs
|-- routes/ # 表示层
| |-- mod.rs
| |-- user_routes.rs
|-- services/ # 业务逻辑层
| |-- mod.rs
| |-- user_service.rs
|-- repositories/ # 数据访问层
| |-- mod.rs
| |-- user_repository.rs
|-- models/ # 模型层
|-- mod.rs
|-- user.rs
```
```
cargo build
cargo run
# Windows
export RUST_LOG=info
```