Example Implementation of GraphQL & Relay server.
Used libraries:
- graphql-js
- graphql-relay-js
- express
- express-graphql
- rethinkdb
- rethinkdb-pool
- nothinkdb
- nothinkdb-graphql
git clone https://github.com/ediket/graphql-relay-rethinkdb-example
cd graphql-relay-rethinkdb-example
npm install
- Run rethinkdb server
rethinkdb
- Sync rethinkdb schema (create db, table, index)
npm run sync
- Run server
npm run start && npm run logs
-
Query & Mutation with http://0.0.0.0:7777/graphql
-
Delete server
npm run delete # or npm run stop
Run server
npm run start
Stop server
npm run stop
Delete server
npm run stop
View server log
npm run logs
query UserConnection {
users(first: 2) {
edges {
node {
id
name
}
}
}
}
mutation CreateUser {
createUser(input: {
clientMutationId: "1",
name: "SOME_USER_NAME"
}) {
user {
id
name
}
}
}
mutation FollowUser {
followUser(input: {
clientMutationId: "1",
followerId: "FOLLOWER_ID",
followeeId: "FOLLOWEE_ID"
}) {
follower {
followers(first: 10) {
edges {
node {
id
name
}
}
}
}
followee {
following(first: 10) {
edges {
node {
id
name
}
}
}
}
}
}
mutation UnfollowUser {
unfollowUser(input: {
clientMutationId: "1",
followerId: "FOLLOWER_ID",
followeeId: "FOLLOWEE_ID"
}) {
follower {
followers(first: 10) {
edges {
node {
id
name
}
}
}
}
followee {
following(first: 10) {
edges {
node {
id
name
}
}
}
}
}
}