问题描述
我是 Postgresql 的新手,想知道是否可以创建一个 http 链接来从表中选择特定数据。
我尝试使用 Postgres,但无法真正遵循文档。 docker 和 postgREST 容器正在运行,但仍然可以通过 HTTP 链接访问数据库。
有什么解决办法吗?
主要目标是使用 http://......../select() From () where time...
类型的结构从数据库中获取数据。
image shows that the setup for postgrest is working
谢谢 问候。
解决方法
您能否粘贴您阅读和使用命令的参考? 粘贴的日志显示权限问题(root 用户不存在。)。 你想要的文档可能是这个。
参考。 https://postgrest.org/en/latest/api.html
为了确认,您可以使用 psql 访问 postgres 吗?如果你能做到,我认为是配置造成的麻烦。你用过这样的执行命令吗?请阅读 postgres-user.conf。
$ ./postgrest postgres-user.conf
在配置中我们可以设置db-uri,指定postgres的角色,db-anon-role是postgres中HTTP API服务器的非授权用户角色。
db-uri = "postgres://authenticator:mysecretpassword@localhost:5433/postgres
db-anon-role = "web_anon"
阅读本教程后,我尝试使用 postgrest 并成功通过 postgrest 获取表数据
参考