hasura graphql-engine v1.0.0-alpha30 remote schema stitch 试用
新的hasura graphql-engine 代码仓库中已经包含了一个基于express 的简单graphql server,
可以用来测试模式拼接
graphql server 代码
- 项目结构
├── Dockerfile
├── README.md
├── now.json
├── package.json
└── server.js
- 代码说明
package.json: 依赖包
{
"name": "nodejs-express-gql-server",
"version": "1.0.0",
"description": "A GraphQL server boilerplate for NodeJS-Express using graphql-js library",
"main": "server.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node -r esm server.js"
},
"author": "Hasura",
"license": "MIT",
"dependencies": {
"express": "^4.16.4",
"express-graphql": "^0.7.1",
"graphql": "^14.0.2"
},
"devDependencies": {
"esm": "^3.0.84"
}
}
server.js: 具体代码
const express = require('express');
const graphqlHTTP = require('express-graphql');
const { buildSchema } = require('graphql');
let count = 0;
const port = process.env.port || 3000;
// Construct a schema, using GraphQL schema language
const schema = buildSchema(`
type Query {
hello: String!
count: Int!
}
type Mutation {
increment_counter: count_mutation_response!
}
type count_mutation_response {
new_count: Int!
}
`);
// The root provides a resolver function for each API endpoint
const root = {
hello: () => {
return 'Hello world!';
},
count: () => {
return count;
},
increment_counter: () => {
return { new_count: ++count }
}
};
var app = express();
app.use('/graphql', graphqlHTTP({
schema: schema,
rootValue: root,
graphiql: true,
}));
app.listen(port);
console.log(`Running a GraphQL API server at localhost:${port}/graphql`);
Dockerfile: 代码的dockeer 运行
FROM node:8
WORKDIR /server
COPY ./package.json /server/
RUN npm install
COPY . /server/
CMD ["npm", "start"]
hasura graphql-engine 环境准备
graphql server 的我已经推送到dockerhub 了 镜像为:dalongrong/stitchmerge
- docker-compose 文件
version: '3.6'
services:
postgres2:
image: postgres:9.6
ports:
- "5432:5432"
environment:
- "POSTGRES_PASSWORD:dalong"
volumes:
- ./db_data2:/var/lib/postgresql/data
postgres:
image: postgres:9.6
ports:
- "5435:5432"
environment:
- "POSTGRES_PASSWORD:dalong"
volumes:
- ./db_data:/var/lib/postgresql/data
benthos:
image: jeffail/benthos
volumes:
- "./configs/webhook.yaml:/benthos.yaml"
ports:
- "4195:4195"
node-exress:
image: dalongrong/stitchmerge
ports:
- "3000:3000"
graphql-engine2:
image: hasura/graphql-engine:v1.0.0-alpha30
ports:
- "8080:8080"
depends_on:
- "postgres"
environment:
- "POSTGRES_PASSWORD:dalong"
command: >
/bin/sh -c "
graphql-engine --database-url postgres://postgres:dalong@postgres2:5432/postgres serve --enable-console;
"
graphql-engine:
image: hasura/graphql-engine:v1.0.0-alpha29
ports:
- "8090: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;
"
- 运行效果
graphql server:
http://localhost:3000/graphql
引擎界面
试用模式拼接功能
- 添加配置
- schema 信息
- 测试
但是,进行混合的时候就有问题了,新版发布的说明里面也有提示,后期应该可以解决
- 查看表结构
说明
这个功能还是很不错的,只是期待可以解决好多已知的问题
参考资料
https://github.com/hasura/graphql-engine
https://github.com/rongfengliang/hasura-graphql-event-benthos
hasura graphql-engine v1.0.0-alpha30 remote schema stitch 试用的更多相关文章
- hasura graphql-engine v1.2.0 beta 版本
hasura graphql-engine v1.2.0 提供了一个很不错的功能action,这个也是目前其他graphql 没有hasura 强大的 地方,使用action 我们可以更好的扩展has ...
- 二进制搭建Kubernetes集群(最新v1.16.0版本)
目录 1.生产环境k8s平台架构 2.官方提供三种部署方式 3.服务器规划 4.系统初始化 5.Etcd集群部署 5.1.安装cfssl工具 5.2.生成etcd证书 5.2.1 创建用来生成 CA ...
- Gitea v1.17.0 正式发布 | 集成软件包管理器、容器镜像仓库
我们自豪地宣布 Gitea v1.17.0 发布了.本次发布带来了诸多新特性和累积的更新,我们强烈建议用户在更新到最新版本之前仔细阅读发行注记. 在 1.17.0 版本的开发中我们一共合并了 645 ...
- Kubeadm搭建高可用(k8s)Kubernetes v1.24.0集群
文章转载自:https://i4t.com/5451.html 背景 Kubernetes 1.24新特性 从kubelet中移除dockershim,自1.20版本被弃用之后,dockershim组 ...
- FineUI(专业版)v1.2.0 和 FineUI(开源版)v4.1.1 同时发布!
FineUI(开源版)v4.1.1 (建议所有 v4.x 升级到此版本):http://fineui.com/demo/ +2014-08-15 v4.1.1 -修正Form中表单字段设 ...
- RapidJSON v1.1.0 发布简介
时隔 15.6 个月,终于发布了一个新版本 v1.1.0. 新版本除了包含了这些日子收集到的无数的小改进及 bug fixes,也有一些新功能.本文尝试从使用者的角度,简单介绍一下这些功能和沿由. P ...
- 使用Advanced Installer 自动部署 Arcgis Engine Runtime 10.0
原文:使用Advanced Installer 自动部署 Arcgis Engine Runtime 10.0 目前采用Arcgis9.2 + c#(vs2008)作为程序开发平台,是一个不错的搭配. ...
- 读阿里巴巴Java开发手册v1.2.0之工程结构有感【架构篇】
首先,把昨天那俩条sql语句的优化原因给大家补充一下,第一条效率极低,第二条优化后的,sql语句截图如下: 经过几个高手的评论和个人的分析: 第一条sql语句查询很慢是因为它首先使用了in关键字查询, ...
- 读阿里巴巴Java开发手册v1.2.0之编程规约有感【架构篇】
不为过去蹉跎,改变当下. 为什么开篇就送这么一句话给大家,我相信很多处于1-3年码龄的哥们儿们,在平时的编码历程中编码的个性可能是多彩的,每个人都有每个人特定的风格,但是我们现在这么随意写,以后这么 ...
随机推荐
- SQL-20 查找员工编号emp_no为10001其自入职以来的薪水salary涨幅值growth
题目描述 查找员工编号emp_no为10001其自入职以来的薪水salary涨幅值growthCREATE TABLE `salaries` (`emp_no` int(11) NOT NULL,`s ...
- 1076 Wifi密码
下面是微博上流传的一张照片:“各位亲爱的同学们,鉴于大家有时需要使用 wifi,又怕耽误亲们的学习,现将 wifi 密码设置为下列数学题答案:A-1:B-2:C-3:D-4:请同学们自己作答,每两日一 ...
- DevExpress WinForms使用教程:SVG图库和Image Picker
[DevExpress WinForms v18.2下载] 每个新版本都在几个新控件中引入了矢量图标支持. 对于v18.2,这是列表: BackstageViewControl及其项目 RecentI ...
- go语言基础学习
go基础学习,面向对象-方法在Go语言中,可以给任意自定义类型(包括内置类型,但不包括指针类型)添加相应的方法 使用= 和:=的区别: // = 使用必须使用先var声明例如: var a a=100 ...
- Nodejs安装express提示不是内部或外部命令
安装nodejs安装包后,通过npm安装express后,运行express提示" express"不是内部或外部命令. c:\express -t ejs web 原因是版本问题 ...
- ChinaCock界面控件介绍-CCLoadingIndicator
这是一个显示等待状态的控件,当在线程中执行一个稍长时间的任务,需要显示一个等待过程,免得让用户不知app在做什么?避免用户寂寞. 先看看这个控件的属性说明: BackgroundTransparenc ...
- scrapy框架简介和基础应用
scrapy框架介绍 环境安装 基础使用 一.什么是Scrapy? Scrapy是一个为了爬取网站数据,提取结构性数据而编写的应用框架,非常出名,非常强悍.所谓的框架就是一个已经被集成了各种功能(高性 ...
- macbook air 获取root权限
以下内容为转载 原创连接:http://blog.itpub.net/26148431/viewspace-1401745/ 1. 从 Apple 菜单中选取系统偏好设置,从显示菜单中选取用户与群组. ...
- 实验吧—隐写术——WP之 Fair-Play
首先,我们读题发现题目是Playfair,其实我也不知道这是什么,那么就百度一下啊 Playfair解密算法: 首先将密钥填写在一个5*5的矩阵中(去Q留Z),矩阵中其它未用到的字母按顺序填在矩阵剩 ...
- mac电脑读写NTFS格式的移动硬盘命令
diskutil info /Volumes/SAMSUNG | grep UUID echo "UUID=38EBE5E4-016F-44B7-9D55-BB4AF6DC3E1D none ...