echo "test /api/notes post"
result=$(curl -X POST -H "Content-Type: application/json" -d '{"id": "", "title": "hello", "content": "vvvv"}' http://localhost:8000/api/notes)
echo "test /api/notes get"
curl http://localhost:8000/api/notes -H "Content-Type: application/json"
echo "test /api/notes delete"
curl -X DELETE http://localhost:8000/api/notes/$result
echo "test /api/note_categories post"
result=$(curl -X POST -H "Content-Type: application/json" -d '{"id": "", "title": "title1", "parent_id": "", "children": [], "created_date": 1}' http://localhost:8000/api/note_categories)
echo $result
echo "test /api/note_category get"
curl http://localhost:8000/api/note_category/03c7deca-cd74-4645-8c33-86e71e6192d2 -H "Content-Type: application/json"
echo "test /api/note_categories delete"
curl -X DELETE http://localhost:8000/api/note_categories/4436aae2-9f43-4eb1-9711-de55cc3122a4
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
Rest Restful 基于rocket服务搭建代码 代码包含的实践用例: 1. restful post, get, put, delete方法 2. 基于rocket的中间层开发,用于日志处理 3. docker部署开发用的postgres 4. async 函数开发 5. async 函数递归调用 6. 路由参数和返回值的序列化 7. 错误处理 8. 数据库连接池 数据库/持久化层:postgres 使用的第三方库: rocket, tokio, tokio-postgres, deadpool-postgres, log, simplelog, futures, async-recursion, serde 更多细节请移步我的blog:Rust Rocket: 构建Restful服务实战,https://caozy.blog.csdn.net/article/details/133386837
资源推荐
资源详情
资源评论
收起资源包目录
note_book_api.zip (17个子文件)
note_book_api
db_scripts
update_container.sh 89B
create_container.sh 205B
init
init_db.sh 197B
update_db.sh 420B
app
Cargo.toml 663B
src
utils.rs 884B
main.rs 1KB
services
mod.rs 233B
note_category.rs 4KB
note_book.rs 2KB
fairings.rs 436B
routes.rs 3KB
models.rs 2KB
Cargo.lock 55KB
test.sh 889B
.gitignore 17B
LICENSE 1KB
共 17 条
- 1
资源评论
明天好,会的
- 粉丝: 326
- 资源: 21
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功