This file contains 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 * 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) => { |
This file contains 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 * 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", () => {}); |
This file contains 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
Show hidden characters
{ | |
"compilerOptions": { | |
"sourceMap": true, | |
"outDir": "dist", | |
"strict": true, | |
"lib": ["esnext", "dom"] | |
} | |
} |
This file contains 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:1.20.0 | |
restart: on-failure | |
ports: | |
- "4466:4466" | |
environment: | |
PRISMA_CONFIG: | | |
port: 4466 |
This file contains 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
endpoint: http://localhost:4466/prisma-blog-graphql/dev | |
datamodel: datamodel.prisma | |
generate: | |
- generator: typescript-client | |
output: ../src/generated/prisma-client/ |
This file contains 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! @unique | |
email: String! @unique | |
posts: [Post!]! | |
name: String! | |
} | |
type Post { | |
id: ID! @unique | |
createdAt: DateTime! |
This file contains 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 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 |
This file contains 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
# Define your datamodel using declarative SDL syntax | |
type User { | |
id: ID! @unique | |
email: String! @unique | |
name: String! | |
} |
This file contains 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
export default { | |
Query: { | |
someOtherResolver: async (root, { jobId }, context) => { | |
const hiringManager = await binding.query.hiringManager({ jobId }, context); | |
return { | |
id: 'YOOOO', | |
hiringManager, | |
someOtherField: { | |
id: 'SUH DUDE', | |
} |
This file contains 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 = { | |
query: { | |
hiringManager: (args, context, info) => {}, | |
jobPost: (args, context, info) => {} | |
} | |
}; |