howtographql/graphql-js

Name: graphql-js

Owner: How to GraphQL

Description: https://www.howtographql.com/graphql-js/1-getting-started/

Created: 2017-06-21 11:49:56.0

Updated: 2018-01-14 18:41:00.0

Pushed: 2018-01-11 20:43:02.0

Homepage:

Size: 85

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

hackernews-graphql-js

This repository contains the final project for the GraphQL.js tutorial on How to GraphQL. Note that it also serves as foundation for all frontend tutorials on the site.

Usage
1. Clone repository
clone https://github.com/howtographql/graphql-js
raphql-js
2. Deploy the Prisma database service
ma deploy

When prompted where (i.e. to which cluster) you want to deploy your service, choose any of the public clusters, e.g. public-us1 or public-eu1. (If you have Docker installed, you can also deploy locally.)

3. Set the Prisma service endpoint

From the output of the previous command, copy the HTTP endpoint and paste it into src/index.js where it's used to instantiate the Prisma binding. You need to replace the current placeholder __PRISMA_ENDPOINT:

t server = new GraphQLServer({
peDefs: './src/schema.graphql',
solvers,
ntext: req => ({
...req,
db: new Prisma({
  typeDefs: 'src/generated/prisma.graphql',
  endpoint: "__PRISMA_ENDPOINT__",
  secret: 'mysecret123',
}),
,

For example:

t server = new GraphQLServer({
peDefs: './src/schema.graphql',
solvers,
ntext: req => ({
...req,
db: new Prisma({
  typeDefs: 'src/generated/prisma.graphql',
  endpoint: "https://eu1.prisma.sh/public-hillcloak-flier-942261/hackernews-graphql-js/dev",
  secret: 'mysecret123',
}),
,

Note that the part public-hillcloak-flier-952361 of the URL is unique to your service.

4. Start the server & open Playground

To interact with the API in a GraphQL Playground, all you need to do is execute the dev script defined in package.json:

 install
 dev

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.