restql 学习一 安装试用

restql 提供了manager 可以方便配置restql 的资源,同时也提供了一个docker-compose 运行环境
以下是一个安装使用

环境准备

  • docker-compose 文件
 
version: '3'
services:
  restql-api:
    image: b2wdigital/restql-http:latest
    ports:
      - "9000:9000"
    environment:
      - MONGO_URL=mongodb://mongodb:27017/restql
  restql-manager:
    image: b2wdigital/restql-manager:latest
    ports:
      - "3000:3000"
    environment:
      - MONGO_URL=mongodb://mongodb:27017/restql
      - RESTQL_SERVER_URL=http://restql-api:9000
  mongodb:
    image: mongo:latest
    ports: 
    - "27017:27017"

启动&&测试

  • 启动
docker-compose  up -d

 

 


配置信息

 

 

  • 一个简单查询

 

 


保存信息

 

 

  • 执行查询

UI 界面

 

 


curl 模拟
即席查询方式

curl --request POST \
     --url "http://localhost:9000/run-query" \
     --header 'content-type: text/plain' \
     --data 'from launches with flight_number = 18'
{"launches":{"details":{"success":true,"status":200,"metadata":{}},"result":{"launch_date_unix":1411278720,"mission_name":"CRS-4","crew":null,"launch_success":true,"mission_id":["EE86F74"],"is_tentative":false,"launch_window":0,"launch_site":{"site_name_long":"Cape Canaveral Air Force Station Space Launch Complex 40","site_name":"CCAFS SLC 40","site_id":"ccafs_slc_40"},"upcoming":false,"tbd":false,"details":null

使用保存的查询

curl --request GET \
     --url "http://localhost:9000/run-query/spacex/get-launch/1?number=18"
{"launches":{"details":{"success":true,"status":200,"metadata":{}},"result":{"launch_date_unix":1411278720,"mission_name":"CRS-4","crew":null,"launch_success":true,"mission_id":["EE86F74"],"is_tentative":false,"launch_window":0,"launch_site":{"site_name_long":"Cape Canaveral Air Force Station Space Launch Complex 40","site_name"

说明

以上是一个简单基本环境安装以及查询学习,后边详细学习查询语法的处理

参考资料

https://github.com/B2W-BIT/restQL-http/tree/master/examples/api-and-manager
http://docs.restql.b2w.io/

posted on 2019-11-16 22:42  荣锋亮  阅读(373)  评论(0编辑  收藏  举报

导航