How to use prisma-binding - 10 common examples

To help you get started, we’ve selected a few prisma-binding examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hmmChase / next-graphql-starter / backend / src / prismaClient.js View on Github external
const { Prisma } = require('prisma-binding');

const { importSchema } = require('graphql-import');

// const typeDefs = importSchema(__dirname + '/schema/generated/prisma.graphql');
const typeDefs = importSchema(__dirname + '/schema/schema_prep.graphql');
// console.log('TCL: typeDefs', typeDefs);

const prisma = new Prisma({
  // typeDefs: __dirname + '/schema/schema_prep.graphql',
  typeDefs,

  endpoint: process.env.PRISMA_ENDPOINT,
  secret: process.env.PRISMA_SECRET
});

module.exports = prisma;
github este / este / server / api.js View on Github external
context: req => ({
    ...req,
    db: new Prisma({
      typeDefs: 'database/schema.graphql',
      endpoint: process.env.PRISMA_ENDPOINT,
      secret: process.env.PRISMA_SECRET,
      debug: false, // dev, // log all GraphQL queries & mutations
    }),
  }),
});
github suprahfly / fontcards / server / src / index.js View on Github external
context: req => ({
        ...req,
        db: new Prisma({
            typeDefs: "src/generated/prisma.graphql",
            endpoint: "http://localhost:4466/node-basic/dev", // the endpoint of the Prisma DB service
            secret: "mysecret123", // specified in database/prisma.yml
            debug: true // log all GraphQL queryies & mutations
        })
    })
});
github hmmChase / next-graphql-starter / backend / src / prisma / prismaClient.js View on Github external
const { Prisma } = require('prisma-binding');

const prisma = new Prisma({
  // typeDefs: __dirname + '/schema/schema_prep.graphql',
  typeDefs: './src/schema/schema_prep.graphql',
  // typeDefs: __dirname + '/schema/generated/prisma.graphql',
  endpoint: process.env.PRISMA_ENDPOINT,
  secret: process.env.PRISMA_SECRET
});

module.exports = prisma;
github Answart / next-store / server / src / db.js View on Github external
// This file connects to the remote prisma DB and gives the ability to query it with JS
const { Prisma } = require('prisma-binding');
const endpoint = (process.env.NODE_ENV == 'production')
  ? process.env.PRISMA_PROD_ENDPOINT
  : process.env.PRISMA_DEV_ENDPOINT;

const db = new Prisma({
  typeDefs: 'src/generated/prisma.graphql',
  endpoint,
  secret: process.env.PRISMA_SECRET,
  debug: false,
});

module.exports = db;
github wesbos / Advanced-React / finished-application / backend / src / db.js View on Github external
const { Prisma } = require('prisma-binding');

const db = new Prisma({
  typeDefs: 'src/generated/prisma.graphql',
  endpoint: process.env.PRISMA_ENDPOINT, // the endpoint of the Prisma DB service (value is set in variables.env)
  secret: process.env.PRISMA_SECRET, // taken from prisma/prisma.yml (value is set in .env)
  debug: false, // log all GraphQL queries & mutations
});

module.exports = db;
github Answart / next-store / server / src / index.js View on Github external
? process.env.PROD_CLIENT_URL
  : process.env.DEV_CLIENT_URL;
const serverUrl = (node_env == 'development')
  ? `${process.env.HOST}:${process.env.PORT}`
  : process.env.PROD_SERVER_URL;

const logs = async (resolve, root, args, context, info) => {
  const result = await resolve(root, args, context, info)
  if (!!context.request && !!context.request.body && typeof result == 'object') {
    console.log(`[${!!context.request.userId ? context.request.userId : 'unknown'}] ${context.request.body.operationName} ${JSON.stringify(context.request.body.variables)}:\n`, result)
  }

  return result;
}

const db = new Prisma({
  typeDefs: 'src/generated/prisma.graphql',
  endpoint,
  secret: process.env.PRISMA_SECRET,
  debug: (node_env == 'development')
    ? true
    : false,
});

const server = new GraphQLServer({
  typeDefs: 'src/schema.graphql',
  resolvers,
  resolverValidationOptions: {
    requireResolversForResolveType: false,
  },
  context: req => ({ ...req, db }),
  middlewares: [logs]
github pizzaql / pizzaql / backend / index.js View on Github external
context: req => ({
		...req,
		prisma: new Prisma({
			typeDefs: './schema.graphql',
			endpoint: 'http://localhost:4466',
			debug: true
		})
	})
});
github jferrettiboke / react-chat-app / server / src / index.js View on Github external
context: req => ({
    ...req,
    prisma: new Prisma({
      typeDefs: "src/generated/prisma.graphql",
      endpoint: "https://eu1.prisma.sh/chat-app/chat-app/dev"
    })
  })
});
github tylim88 / Create-Prisma-App / template / src / prismaBinding.js View on Github external
import { Prisma } from 'prisma-binding'
import { fragmentReplacements } from './resolvers/index'

const prisma = new Prisma({
  typeDefs: process.env.PRISMA_SCHEMA,
  endpoint: process.env.PRISMA_ENDPOINT,
  secret: process.env.PRISMA_SECRET,
  fragmentReplacements,
})

export { prisma as default }

prisma-binding

[![CircleCI](https://circleci.com/gh/prisma/prisma-binding.svg?style=shield)](https://circleci.com/gh/prisma/prisma-binding) [![npm version](https://badge.fury.io/js/prisma-binding.svg)](https://badge.fury.io/js/prisma-binding)

MIT
Latest version published 5 years ago

Package Health Score

57 / 100
Full package analysis

Popular prisma-binding functions

Similar packages