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年码龄的哥们儿们,在平时的编码历程中编码的个性可能是多彩的,每个人都有每个人特定的风格,但是我们现在这么随意写,以后这么 ...
随机推荐
- vsts 管理 持续集成 跟自动化测试
1.代理池: 在服务器上,打开你的TFS Web站点,并转到管理页的代理池页面.如: https://www.cnblogs.com/atwind/p/5486881.html 低版本无法生成高版本. ...
- EF code first Mysql 更换主键类型
把主键从long 改为int 居然要删掉重建,不知道有没有更好的办法. 删除带外键的表: Add-Migration name 修改生成的文件,主要把dbo.删除 然后update-database
- oracle截取字符串区间段的一部分字符串
Oracle SQL中实现indexOf和lastIndexOf功能,substr和instr用法 博客分类: oracle PL/SQL instrsubstrlastindexofindexofo ...
- JavaWeb:c3p0配置问题java.lang.NoClassDefFoundError: com/mchange/v2/ser/Indirector
错误显示 java.lang.NoClassDefFoundError: com/mchange/v2/ser/Indirector at dbdemo.JdbcUtils.<clinit> ...
- 使用Maven+ssm框架搭建一个web项目
1,前期准备:Eclipse(Mars.2 Release (4.5.2)).jdk1.7.tomcat7.maven3.2.1 2.使用eclipse中的maven新建一个web项目 点击next: ...
- Java学习笔记32(IO:序列化流)
对象中的数据 ,以流的形式,写入到文件中保存,过程称为写出对象,对象的序列化 ObjectOutputStream将对象写到序列中,实现序列化 在文件中,以流 的形式,将对象读取出来,过程称为读取对象 ...
- golang写的反弹shell(自作孽不可活,切记,切记!)
仅作安全研究 package main import ( "os/exec" "go-pop3" "log" "strings&q ...
- vue 路由跳转,路由传参的几种方式
1. router-link <router-link :to="{ path: 'yourPath', params: { name: 'name', dataObj: data } ...
- VS2017调试代码显示“当前无法命中断点,还没有为该文档加载任何符号”
VS2017升级之后,代码调试无法进入,显示“当前无法命中断点,还没有为该文档加载任何符号”的问题解决思路: 1.工具-选项-项目和解决方案-生成并运行,取消勾选“在运行时仅生成启动项目和依赖性” 2 ...
- [转]ZooKeeper 集群环境搭建 (本机3个节点)
ZooKeeper 集群环境搭建 (本机3个节点) 是一个简单的分布式同步数据库(或者是小文件系统) ------------------------------------------------- ...