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
| apiVersion: extensions/v1beta1 | |
| kind: Deployment | |
| metadata: | |
| name: database | |
| namespace: prisma | |
| labels: | |
| stage: production | |
| name: database | |
| app: mysql | |
| spec: |
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
| apiVersion: v1 | |
| kind: Service | |
| metadata: | |
| name: database | |
| namespace: prisma | |
| spec: | |
| ports: | |
| - port: 3306 | |
| targetPort: 3306 | |
| protocol: TCP |
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
| apiVersion: extensions/v1beta1 | |
| kind: Deployment | |
| metadata: | |
| name: prisma | |
| namespace: prisma | |
| labels: | |
| stage: production | |
| name: prisma | |
| app: prisma | |
| spec: |
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
| { | |
| generateKeypair { | |
| public | |
| private | |
| } | |
| } |
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
| apiVersion: v1 | |
| kind: Service | |
| metadata: | |
| name: prisma | |
| namespace: prisma | |
| spec: | |
| ports: | |
| - port: 4466 | |
| targetPort: 4466 | |
| protocol: TCP |
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
| if (!areCredentialsValid) { | |
| throw new Error("Authentication required"); | |
| } |
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
| // path: resolvers/mutation/login/errors/WrongCredentialsError.ts | |
| import { createError } from "apollo-errors"; | |
| const WrongCredentialsError = createError("WrongCredentialsError", { | |
| message: "The provided credentials are invalid." | |
| }); | |
| export { WrongCredentialsError } |
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
| // path: resolvers/mutation/login/index.ts | |
| import { WrongCredentialsError } from "./errors/WrongCredentialsError"; | |
| interface LoginInput { | |
| username: string; | |
| password: string; | |
| } | |
| const login = await (parent, args: LoginInput, context: Context, info) { |
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
| { | |
| "data": {}, | |
| "errors": [ | |
| { | |
| "message":"The provided credentials are invalid.", | |
| "name":"WrongCredentialsError", | |
| "time_thrown":"2018-02-14T00:40:50.954Z", | |
| } | |
| ] | |
| } |
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 { GraphQLServer, Options } from "graphql-yoga"; | |
| import { formatError } from "apollo-errors"; | |
| const options: Options = { | |
| formatError | |
| }; | |
| const server = new GraphQLServer({ typeDefs, resolvers }) | |
| server.start(options, () => console.log('GraphQL API is running on localhost:4000')) |