Skip to content
This repository has been archived by the owner on Sep 2, 2022. It is now read-only.

Commit

Permalink
Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
DevanB authored and Nilan Marktanner committed Jan 16, 2018
1 parent ea252d7 commit e0816f1
Show file tree
Hide file tree
Showing 9 changed files with 1,573 additions and 104 deletions.
8 changes: 4 additions & 4 deletions examples/1.0/resolver-forwarding/.env
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
NODE_ENV="dev"
GRAPHCOOL_STAGE="dev"
GRAPHCOOL_CLUSTER="local"
GRAPHCOOL_ENDPOINT="http://localhost:60000/resolver-forwarding/dev"
GRAPHCOOL_SECRET="so-secret"
PRISMA_STAGE="dev"
PRISMA_CLUSTER="local"
PRISMA_ENDPOINT="http://localhost:60000/resolver-forwarding/dev"
PRISMA_SECRET="so-secret"
APP_SECRET="jwtsecret123"
4 changes: 2 additions & 2 deletions examples/1.0/resolver-forwarding/.graphqlconfig.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ projects:
endpoints:
default: "http://localhost:4000"
database:
schemaPath: "src/generated/graphcool.graphql"
schemaPath: "src/generated/prisma.graphql"
extensions:
graphcool: database/graphcool.yml
prisma: database/prisma.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
service: passthrough

# the cluster and stage the service is deployed to
stage: ${env:GRAPHCOOL_STAGE}
cluster: ${env:GRAPHCOOL_CLUSTER}
stage: ${env:PRISMA_STAGE}
cluster: ${env:PRISMA_CLUSTER}

# to disable authentication:
# disableAuth: true
secret: ${env:GRAPHCOOL_SECRET}
secret: ${env:PRISMA_SECRET}

# the file path pointing to your data model
datamodel: database/datamodel.graphql
9 changes: 7 additions & 2 deletions examples/1.0/resolver-forwarding/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,19 @@
},
"dependencies": {
"bcryptjs": "2.4.3",
"graphcool-binding": "1.3.3",
"prisma-binding": "1.3.7",
"graphql-yoga": "1.1.5",
"jsonwebtoken": "8.1.0"
},
"devDependencies": {
"dotenv": "4.0.0",
"graphcool": "1.0.0-beta4.1.1",
"prisma-cli": "beta",
"graphql-cli": "2.10.1",
"nodemon": "1.14.7"
},
"prettier": {
"semi": false,
"singleQuote": true,
"trailingComma": "all"
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# THIS FILE HAS BEEN AUTO-GENERATED BY THE "GRAPHCOOL DEPLOY"
# THIS FILE HAS BEEN AUTO-GENERATED BY "PRISMA DEPLOY"
# DO NOT EDIT THIS FILE DIRECTLY

#
Expand Down
12 changes: 6 additions & 6 deletions examples/1.0/resolver-forwarding/src/index.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
const { GraphQLServer } = require('graphql-yoga')
const { Graphcool } = require('graphcool-binding')
const { Prisma } = require('prisma-binding')
const resolvers = require('./resolvers')

const server = new GraphQLServer({
typeDefs: 'src/schema.graphql',
resolvers,
context: req => ({
...req,
db: new Graphcool({
typeDefs: 'src/generated/graphcool.graphql',
endpoint: process.env.GRAPHCOOL_ENDPOINT,
secret: process.env.GRAPHCOOL_SECRET,
db: new Prisma({
typeDefs: 'src/generated/prisma.graphql',
endpoint: process.env.PRISMA_ENDPOINT,
secret: process.env.PRISMA_SECRET,
debug: true,
}),
}),
})

server.start(() => console.log('Server is running on http://localhost:4000'))
server.start(({ port }) => console.log(`Server is running on http://localhost:${port}`))
2 changes: 1 addition & 1 deletion examples/1.0/resolver-forwarding/src/resolvers/Mutation.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { forwardTo } = require('graphcool-binding')
const { forwardTo } = require('prisma-binding')

// here you see the difference between forwarding and delegating a mutation
const Mutation = {
Expand Down
4 changes: 2 additions & 2 deletions examples/1.0/resolver-forwarding/src/resolvers/Query.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { forwardTo } = require('graphcool-binding')
const { forwardTo } = require('prisma-binding')

/*
* This is a simple case of passing through a query resolver from the DB to the app
Expand All @@ -10,7 +10,7 @@ const { forwardTo } = require('graphcool-binding')
* to forward the `posts` query to the database
*/
const Query = {
posts: forwardTo('db')
posts: forwardTo('db'),
}

module.exports = { Query }
Loading

0 comments on commit e0816f1

Please sign in to comment.