这个资源是Rust的源代码压缩包,供大家了解Rust Yew的前后端开发。
资源中的代码非常简洁易懂,虽然离商用场景还有一段距离,但是涵盖了前端的组件搭建、事件通信和反向代理,以及后端的Restful API的路由、功能实现和数据库访问。此外,还包括了postgres数据库的初始化脚本和docker部署脚本,方便您快速搭建环境。
希望这个资源能够帮助大家更好地了解和掌握Rust Yew的开发技巧,帮助大家快速入门。
如果大家对资源的使用有问题,请留言,我尽量当日解答。
(下载链接还在审核中…请稍后)
资源的介绍。
zycao@192 note_book % tree
.
├── note_book_api
│ ├── LICENSE
│ ├── app
│ │ ├── Cargo.lock
│ │ ├── Cargo.toml
│ │ ├── src
│ │ │ ├── main.rs
│ │ │ ├── models.rs
│ │ │ ├── routes
│ │ │ │ ├── mod.rs
│ │ │ │ └── notes.rs
│ │ │ └── services
│ │ │ ├── mod.rs
│ │ │ └── note_book.rs
│ │ └── test.sh
│ └── db_scripts
│ ├── create_container.sh
│ └── init
│ └── init_db.sh
└── note_book_front
├── LICENSE
└── app
├── Cargo.lock
├── Cargo.toml
├── index.html
├── index.scss
├── serve.sh
└── src
├── bin
│ ├── ssr_hydrate.rs
│ └── ssr_server.rs
├── components
│ ├── base
│ │ ├── button.rs
│ │ ├── mod.rs
│ │ └── modal1.rs
│ ├── editor1.rs
│ ├── mod.rs
│ └── table_component.rs
├── lib.rs
├── models.rs
└── utils.rs
13 directories, 29 files
作为前提,请在当前环境中安装Rust和Docker CE。
在当前的时间点上,我安装的是Rust rustc 1.74.0-nightly
。
安装命令如下:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
rustup install nightly # 安装nightly版本
rustup default nightly # 将nightly版本设置为默认版本
Docker CE的安装不是必须的,如果你的当前环境下面已经安装了Postgres数据库引擎,可以直接用note_book_api/db_scripts/init/init_db.sh
中的脚本内容来初始化需要的表。
创建Postgres的Docker容器
cd note_book_api/db_scripts
chmod 777 create_container.sh # 注意create_container中使用了环境变量,请设置相关的环境变量
./create_container.sh
Docker环境的postgres数据库启动
sudo docker start notes_db
后动note_book_api
启动
cd note_book_api/app
cargo run
前端note_book_front
启动
cd note_book_front/app
chmod 777 serve.sh
./serve.sh
如果大家对资源的使用有问题,请留言,我尽量当日解答。