What’s New In GRANDstack?
转自:https://blog.grandstack.io/whats-new-in-grandstack-310c067fea4a
There’s been a lot of activity in the GRANDstack world recently so in this post we review some of the new features and take a look at what community members have been working on.
GRANDstack is a fullstack framework for building applications using GraphQL, React, Apollo, and Neo4j Database.
Implementing authorization in GraphQL has long been an area of interest for developers working with GraphQL. Beginning in version 2.4.0 of neo4j-graphql.js we’ve introduced features to make implementing authorization easier. Specifically, we’ve added authorization specific schema directives that work with JSON Web Tokens (JWTs) out of the box, and the ability to access context values in Cypher queries.
Schema Directives
Based on the prototype described in this post, “Authorization In GraphQL Using Custom Schema Directives”, you can now make use of the following authorization schema directives in your GraphQL type definitions with neo4j-graphql.js:
isAuthenticatedhasRolehasScope

You can read more about using schema directives for securing your GraphQL API in the docs here, or see the example project and post here.
Context Values Into Cypher Query
Another authorization feature in neo4j-graphql.js is the ability to access values from the context object in a Cypher query specified in a@cypherdirective. This is useful when using authorization middleware (such as Passport) that adds user information to the request object, or to access a JWT token that contains user information to be matched against the database.
Here’s how it works: First, add a cypherParams object to the context. Here’s how that looks when using Apollo Server:
const server = new ApolloServer({
context: ({req}) => ({
driver,
cypherParams: {
currentUserId: req.user.id
}
})
})
Any values within cypherParamin the context object will then be available in Cypher queries making use of the@cypherschema directive as Cypher parameters. Here we look up the currently authenticated user by using the currentUserId value that we added to the context object above:
type Query {
currentUser: User @cypher(statement: """
MATCH (u:User {id: $cypherParams.currentUserId})
RETURN u
""")
}
You can read more about these authorization features in the neo4j-graphql.js documentation.
GraphQL Foundation
In March, the Linux Foundation announced the formation of the GraphQL Foundation, a neutral group set up to provide governance and vendor-neutral stewardship for GraphQL. This includes oversight of funding, operations and marketing resources for the GraphQL community. Neo4j is happy to be included in this group as a founding member.

Neo4j joined the newly formed GraphQL Foundation as a founding member in March.
As Emil says, GraphQL and GRANDstack have been a huge boost for developers using Neo4j and we want to make sure this continues:
“Neo4j is pleased to support GraphQL, due to its unique ability to enable front-end developers, API developers and data architects to all work with the same graph-based data model. Our GraphQL integration and GRANDstack have already helped thousands of developers build graph applications with Neo4j, thanks to the huge developer productivity gain of GraphQL and the graph thinking mindset it brings for both developers and API consumers. The GraphQL Foundation is an important step to cement today’s most relevant standard for building APIs and we’re honored to join as founding members to help steward GraphQL as the ecosystem continues to evolve.”
— Emil Eifrem, CEO and Co-Founder, Neo4j
Neo4j GraphQL Java
The neo4j-graphql.js library has been an important component of GRANDstack for those building node.js APIs, but what if you want to use languages other than node.js? To support Java / JVM based APIs we’ve been working on neo4j-graphql-java, a JVM library to translate GraphQL queries and mutations to Cypher for use with Neo4j.

neo4j-graphql-java milestone release 2 is now available!
neo4j-graphql-java has had a second milestone release earlier this week with loads of new features such as
- handling relationships via
@relationdirective on schema fields, including support for rich relationship types @cypherdirective for fields and top-level queries and mutations- auto-generation of Query and Mutation fields from type definitions
- andmuch more!
Please give it a try, check out the project’s documentation, and open issues for any feedback.

A slide from Rhys Evans’s talk “A Field Guide To The Financial Times”
From The Community
The GRANDstack community has been working on some great projects, here’s just a few that we’d like to share with you.
- Gavin Williams from Quandercame on the Neo4j Online Meetup and shared how to build a GraphQL API with Neo4j. You can find the video here.
- Rhys Evans from The Financial Times presented “A Field Guide To The Financial Times” where he shared how the FT is using GRANDstack. You can find the slides here.
- Matt Ross from Comcast created a video course on Egghead “Build a Neo4j & GraphQL API” where he shows how to use neo4j-graphql.js to generate a GraphQL API backed by Neo4j using only GraphQL type definitions.
- Erik Rahm, Senior Software Engineer at CyberGRX, released grand-stack-seed, a GRANDstack seed project with built in local auth, Facebook OAuth, and sample GraphQL types, queries, and mutations.
Share Your GRANDstack story
Do you have a neat GRANDstack project you’ve been working on? Please consider sharing your story by submitting a talk to GraphQL Summit in San Francisco or ping me to be an author on theGRANDstack blog.
What’s New In GRANDstack?的更多相关文章
- grandstack graphql 开发模型
当前grandstack 支持两类开发方式 js (使用Neo4j-graphql-js) 插件模型 js 模型 参考https://github.com/rongfengliang/grand-st ...
- grandstack graphql 工具基本试用
grandstack 是一个方便graphql 应用开发的工具 使用docker-compose 运行 环境准备 官方的starter 比较好,已经是使用docker-compose 创建好了所有 ...
- grandstack 基于graphql&&react&& apollo&& neo4j 的全栈开发工具
grandstack是一个基于graphql&&react&& apollo&& neo4j 的全栈开发工具. 有篇关于graphql 的5个常见问题的 ...
随机推荐
- 正确开启Mockjs的三种姿势:入门参考(一)
一.文章初衷 阅读本文章需要注意以下几点: 文章不主要介绍Mockjs的使用语法 文章暂不涉及Mockjs的第三方封装框架 文章会结合以往做过上线项目的方式总结 想主要介绍如何使用Mockjs,是因为 ...
- 使用RStudio调试(debug)基础学习(一)
点击行号的左侧,即可设置断点(或者按下Shift+F9),如果没有出现,反而出现下图的警告: 那么只是因为我的坏习惯--写一段脚本测试的时候都是新建,但不save到本地,不喜欢保存,写的差不多了才开始 ...
- Could not process inbound connection: Client [/rostopic_18439_1555659423249] wants topic , ROS md5sums do not match
报错如下: [WARN] [WallTime: ', 'md5sum': '0d0edf749cdde9f3dc5639668f40e90b', 'topic': '/bp_update_feedba ...
- 第二周javaweb学习进度表
第一周 所花时间 三天 代码量 200行 博客量 3篇 知识点了解到的 学习到了HTML编程语言的相关知识比如checkbox复选框和radio单选按钮以及form表单的使用方法,form表单可以 ...
- SSH免密码登录教程
在一些受信任的环境中配置免密码登录,是比较方便的:而对于ansible等自动化工具配置免密码登录更是必要的. 免密码登录的要点就是,把想让服务器信任的客户机的公钥发送到服务器. 当客户机连接服务器时直 ...
- 使用MongoDB数据库(2)(三十六)
快速开始使用Spring-data-mongodb 若MongoDB的安装配置采用默认端口,那么在自动配置的情况下,我们不需要做任何参数配置,就能马上连接上本地的MongoDB.下面直接使用sprin ...
- NopCommerce 更改发票字体
NopCommerce 默认是用~/App_Data/Pdf/FreeSerif.ttf 这个字体的. 用这个字体,发票里的中文不能显示. 可以把c:\windows\font\simhei.ttf ...
- cocoa pods自己的笔记
备注:这里只是个人的观点,有的地方也是copy,多多指教,个人笔记,有侵犯你们版权的地方还望海涵!!! 卡主不动 安装流程:http://www.tuicool.com/articles/qaMfuy ...
- Centos7修改分区空间
一:缩小/home空间 1.1:备份/home内容 cp -r /home/* /homebak 1.2:删除挂载/home umount /home 1.3:删除/home所在lv lvremove ...
- Java容器解析系列(1) 迭代的进化——从Enumeration到Iterator
在Java中,对于所有的Collection,都有一个特性,可以通过迭代器来遍历和删除其中的元素,因为Collection接口继承自Iterable接口. public interface Colle ...