Skip to content

Instantly share code, notes, and snippets.

View abhiaiyer91's full-sized avatar

Abhi Aiyer abhiaiyer91

  • Netlify
  • Los Angeles
View GitHub Profile
import * as express from "express";
import * as bodyParser from "body-parser";
import { prisma } from "./generated/prisma-client";
const server = express();
server.use(bodyParser.json());
// User APIs
server.post("/create/user", async (req, res) => {
import * as express from "express";
import * as bodyParser from "body-parser";
const server = express();
server.use(bodyParser.json());
// User APIs
server.post("/create/user", () => {});
server.get("/user/:id", () => {});
{
"compilerOptions": {
"sourceMap": true,
"outDir": "dist",
"strict": true,
"lib": ["esnext", "dom"]
}
}
version: '3'
services:
prisma:
image: prismagraphql/prisma:1.20.0
restart: on-failure
ports:
- "4466:4466"
environment:
PRISMA_CONFIG: |
port: 4466
endpoint: http://localhost:4466/prisma-blog-graphql/dev
datamodel: datamodel.prisma
generate:
- generator: typescript-client
output: ../src/generated/prisma-client/
type User {
id: ID! @unique
email: String! @unique
posts: [Post!]!
name: String!
}
type Post {
id: ID! @unique
createdAt: DateTime!
type Query {
user(where: UserWhereUniqueInput!): User
users(where: UserWhereInput, orderBy: UserOrderByInput, skip: Int, after: String, before: String, first: Int, last: Int): [User]!
usersConnection(where: UserWhereInput, orderBy: UserOrderByInput, skip: Int, after: String, before: String, first: Int, last: Int): UserConnection!
node(id: ID!): Node
}
type Mutation {
createUser(data: UserCreateInput!): User!
updateUser(data: UserUpdateInput!, where: UserWhereUniqueInput!): User
# Define your datamodel using declarative SDL syntax
type User {
id: ID! @unique
email: String! @unique
name: String!
}
export default {
Query: {
someOtherResolver: async (root, { jobId }, context) => {
const hiringManager = await binding.query.hiringManager({ jobId }, context);
return {
id: 'YOOOO',
hiringManager,
someOtherField: {
id: 'SUH DUDE',
}
const binding = {
query: {
hiringManager: (args, context, info) => {},
jobPost: (args, context, info) => {}
}
};