项目作者: Pepeye

项目描述 :
Relay Starter App
高级语言: JavaScript
项目地址: git://github.com/Pepeye/relay-starter.git
创建时间: 2016-06-14T22:48:23Z
项目社区:https://github.com/Pepeye/relay-starter

开源协议:

下载


relay-starter: Relay/GraphQL Starter

GraphQL server using node / express and written in ES6 (ES2015) and ES7 (ES2016).

I built this starter because there are limited examples I’ve found of Relay flavoured GraphQL backends built in a modular manner. Most examples are of Todo apps with simple one file schemas. I was getting into undefined nodes OR cyclical node errors until i discovered some interesting approaches here: Abstract type resolution for node definitions.

Getting Started

  1. npm i

create a file in the project root called .env and within it set environment variables NEO4J_USER and NEO4J_PASS. Note you can also edit database credentials in the file src/lib/db.js

example .env file

  1. NODE_ENV=development
  2. NEO4J_USER=neo4j
  3. NEO4J_PASS=neopass
  4. DEBUG=api:*

to start, run:

  1. npm start

To run tests:

  1. npm test

Database

Sample database is the Neo4j Movie database found here. This starter kit is using Neo4j 3.0 but feel free to swap in your own database.

Install

Setup you Neo4j database as per above running the Movie sample then the following instructions

  1. #clone the repo
  2. git clone https://github.com/Pepeye/relay-starter.git
  3. cd relay-starter
  4. npm install
  5. # first ensure Neo4j is running (port 7474), then:
  6. npm start

Once running visit:

Stack

TODO

  • Introduce Relay flavoured (connections/nodes) GraphQL
  • Move GraphQL code back into previous modules/models
  • Add example mutation
  • Add custom GraphQL scalar types
  • Add typing with flow, example typed test
  • Setup karma test runner with coverage and mocha for studentsPerClass
  • Testing: introduce stubs