This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| query { | |
| users { | |
| id | |
| name | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| mutation { | |
| createUser(name: "Alice") { | |
| id | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const userBinding = require('graphql-binding-users') | |
| // Retrieve all `User`s | |
| userBinding.query.users({}, `{ id name }`) | |
| .then(users => console.log(`Retrieved all users: ${users}`)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const userBinding = require('graphql-binding-users') | |
| // Create a new `User` | |
| userBinding.mutation | |
| .createUser( | |
| { | |
| name: 'Alice', | |
| }, | |
| `{ id }`, | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| type User { | |
| id: ID! | |
| name: String | |
| } | |
| type Query { | |
| users: [User!]! | |
| } | |
| type Mutation { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| type User @pgTable(name: "users") { | |
| id: ID! @unique | |
| isAdmin: Boolean! @default(value: false) | |
| posts: [Post!]! | |
| comments: [Comment!]! | |
| } | |
| type Post @pgTable(name: "posts") { | |
| id: ID! @unique | |
| title: String! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| version: '3' | |
| services: | |
| prisma: | |
| image: prismagraphql/prisma | |
| restart: always | |
| ports: | |
| - "4466:4466" | |
| environment: | |
| PRISMA_CONFIG: | | |
| port: 4466 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const typeDefs = ` | |
| type Query { | |
| hello(name: String): String | |
| } | |
| ` | |
| const resolvers = { | |
| Query: { | |
| hello: (_, args) => `Hello ${args.name || 'World'}!`, | |
| }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { makeBindingClass } from 'graphql-binding' | |
| import helloSchema from './helloSchema' | |
| export default const HelloBinding = makeBindingClass(helloSchema) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const binding = new HelloBinding() | |
| binding.query.hello({ name: 'Alice' }) |