# postgrest-todo-app-demo **Repository Path**: Lemon-9/postgrest-todo-app-demo ## Basic Information - **Project Name**: postgrest-todo-app-demo - **Description**: No description available - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2023-11-05 - **Last Updated**: 2023-11-05 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Postgrest Todo Demo ## 介绍 Postgrest是一个工具,可以将PostgreSQL发布为RestFul服务。 本项目是基于Postgrest的Todo示例,并且集成了JWT验证模块,参考的内容见扩展资料。 ## 使用 1. 在PG中建立一个数据库,如 my_todo_app 2. 执行 `todo_app.sql` 3. 在`todo_app.conf`中,编辑你的数据库连接信息。jwt_secret、app.settings.jwt_secret更改为任意32位的字符串(推荐)。 4. 执行以下命令,服务在3000端口启动, ``` .\bin\postgrest.exe .\todo_app.conf ``` 5. 测试以下接口 ``` 查询列表 GET /todos 测试生成jwt字符串 POST /rpc/jwt_test 登陆接口,获取jwt字符串 POST /rpc/login Body { "username": "admin", "pass": "password" } Response { token: '' } 添加一条数据,注意填写jwt字符串 POST /todos Body { "task": "测试token" } Authorization: Bearer ``` ## 扩展资料 1. 本项目提供了开发文档,是在官方教程中提炼并总结出来的一些开发流程。 2. 官方文档:`https://postgrest.org/en/stable/` 3. 本项目参考了这篇文章,感谢作者的总结:PostgREST 完整示例教程:`https://blog.csdn.net/henjuewang/article/details/105021615` 4. `index.html.bak`是在博客中复制过来的简易前端界面,可以根据需要进行修改。 ## 联系我 email:1501731393@qq.com