medelman
04/14/2018, 2:12 PMmax
04/14/2018, 6:32 PMApex up
or Serverless
? Are you following a tutorial?medelman
04/14/2018, 6:35 PMmax
04/14/2018, 6:35 PMmedelman
04/14/2018, 6:36 PMmax
04/14/2018, 6:37 PMmax
04/14/2018, 6:37 PMmax
04/14/2018, 6:37 PMmedelman
04/14/2018, 6:39 PMmax
04/14/2018, 6:39 PMmax
04/14/2018, 6:40 PMmedelman
04/14/2018, 6:40 PMmax
04/14/2018, 6:41 PMGraphQLServer
(not graphqlLambda
)max
04/14/2018, 6:41 PMmedelman
04/14/2018, 6:42 PMmax
04/14/2018, 6:42 PMmax
04/14/2018, 6:43 PMimport { GraphQLServer } from 'graphql-yoga'
import { Prisma } from './generated/prisma'
import resolvers from './resolvers/resolvers'
const { PRISMA_ENDPOINT, PRISMA_SECRET, NODE_ENV, PORT } = process.env;
// the playground defaults to this port and not sure how to change it in dev mode
const port = PORT ? parseInt(PORT, 10) : 4000
const endpoint = NODE_ENV==="development" ? `${PRISMA_ENDPOINT}/dev` : `${PRISMA_ENDPOINT}/prod`;
const server = new GraphQLServer({
typeDefs: './src/schema.graphql',
resolvers,
context: req => ({
...req,
db: new Prisma({
endpoint, // the endpoint of the Prisma DB service (value is set in .env)
secret: PRISMA_SECRET, // taken from database/prisma.yml (value is set in .env)
debug: NODE_ENV==="development" ? true : false, // log all GraphQL queries & mutations
}),
}),
})
server.start({ port }, () => console.log(`Server is running on <http://localhost:${PORT}`>))
@medelmanmedelman
04/14/2018, 6:43 PMmax
04/14/2018, 6:44 PM/
? "https:///us1.prisma.shmedelman
04/14/2018, 6:45 PMmedelman
04/14/2018, 6:45 PMmedelman
04/14/2018, 6:45 PMmax
04/14/2018, 6:45 PMmedelman
04/14/2018, 6:47 PMmedelman
04/14/2018, 6:48 PMmax
04/14/2018, 6:48 PMmax
04/14/2018, 6:48 PMmax
04/14/2018, 6:48 PMmax
04/14/2018, 6:49 PMmedelman
04/14/2018, 6:49 PM