hasura graphql 引擎基本試用

hasura 使用一個基於pg數據庫的graphql引擎,他的設計比postgrpahql 有好多方便的地方,同時使用也比較簡單html

安裝

docker && docker-composegit

curl -L https://cli.hasura.io/install.sh | bash
hasura init --directory my-project
cd my-project/install-scripts
docker-compose up -d

生成結果

├── config.yaml
├── install-scripts
│ ├── docker-compose.yaml
│ └── docker-run.sh
└── migrations

代碼說明

主要是docker-compose.yamlgithub

version: '3.6'
services:
  postgres:
    image: postgres
    ports:
    - "5432:5432"
    environment:
    - "POSTGRES_PASSWORD:dalong"
    volumes:
    - db_data:/var/lib/postgresql/data
  graphql-engine:
    image: hasura/graphql-engine:v1.0.0-alpha06
    ports:
    - "8080:8080"
    depends_on:
    - "postgres"
    environment:
    - "POSTGRES_PASSWORD:dalong"
    command: >
      /bin/sh -c "
      graphql-engine --database-url postgres://postgres:dalong@postgres:5432/postgres serve --enable-console;
      "
volumes:
  db_data:

操做界面


參考資料

https://github.com/hasura/graphql-engine
https://docs.hasura.io/1.0/graphql/manual/getting-started/docker-simple.htmlsql

相關文章
相關標籤/搜索