我的测试环境使用docker 进行的安装

基本安装

./start_containers.sh
  • postgraphile(postgraphql)
npm install -g postgraphile

基本使用

  • 创建数据库
psql -U postgres -h localhost
create database appdemo
  • 启动postgraphile

    使用watch 参数可以自动更新api

postgraphile -c "postgres://postgres:postgres@localhost:5432/appdemo" --watch

参考结果

  • 使用graphql playground访问
  • 创建表
create table person (
id serial primary key,
name varchar not null,
about text,
email varchar not null unique,
created_at timestamp default current_timestamp
);

自动更新结果

  • 数据查询操作
query {
allPeople{
nodes {
id
name
}
}
}

  • 添加数据
mutation {
createPerson(input:{
clientMutationId:"demoappdemo",
person:{
name:"dalong",
about:"demoappdemo",
email:"1141591465@qq.com",
createdAt:"2018-07-10"
}
}){
person {
name
about
email
}
}
}

与prisma比较

主要是扩展行行,prisma是多数据库支持的,基于nodejs 开发模式,同时生态不错,有好多相关的组件,使用上主要
以模型优先的模式,postgraphile 相对就简单了,只需要安装基本上不用写代码(当然角色,权限的问题,依然需要处理,
而且在ID的处理上postgraphile有点模糊,还有待仔细阅读。
详细的比较后边会有介绍

参考资料

https://www.graphile.org/postgraphile/introduction/
https://www.prisma.io/

 
 
 
 

最新文章

  1. [转载]tlb、tlh和tli文件的关系
  2. (转载)String.IsNullorEmpty()方法的使用
  3. 详解;(function ($,window,document,undefined){...})(jQuery,window,document);
  4. xcode6 使用MJRefresh
  5. 给debian安装xfce桌面套装
  6. 【转】emulator: ERROR: Could not load OpenGLES emulation library: lib64OpenglRender.so
  7. 从开发到部署,使用django创建一个简单可用的个人博客
  8. 修改apache配置文件去除thinkphp url中的index.php
  9. UVa816,Ordering Tasks,WA
  10. poj-1056-IMMEDIATE DECODABILITY(字典)
  11. 1077. Kuchiguse (20)
  12. 吴恩达课后作业学习2-week3-tensorflow learning-1-例子学习
  13. linq总结系列(一)---基础部分
  14. scala生态圈概览
  15. CreateUserWizard控件的使用
  16. 测试开发之Django——No2.Django的安装以及项目创建
  17. Castle ActiveRecord学习(二)配置、引用、程序启动
  18. 各种IDE的使用
  19. 19-[JavaScript]-DOM
  20. NormalMap & CubeMap

热门文章

  1. Cup fungus in Corvobado Nation Park,Costa Rica
  2. spark环境安装
  3. 详细了解下PHP的curl函数及常用之处
  4. P3327/bzoj3994 [SDOI2015]约数个数和(莫比乌斯反演)
  5. install ros-indigo-map-server
  6. Java 集合-Collections工具类
  7. jquery ui是什么
  8. 前端框架MVVM是什么(整理)
  9. 递归--练习8--noi1788Pell数列
  10. 这些HTML、CSS知识点,面试和平时开发都需要 No8-No9(知识点:媒体操作、构建表单)