-
-
Notifications
You must be signed in to change notification settings - Fork 112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat/typegraphql #86
feat/typegraphql #86
Conversation
rwieruch
commented
Apr 19, 2020
- use TypeGraphQL instead of Apollo Schema + GraphQL Code Gen (server)
@@ -1,14 +1,6 @@ | |||
schema: http://localhost:3000/api/graphql | |||
|
|||
generates: | |||
src/generated/server.ts: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- remove server graphql code gen in favor of TypeGraphQL
useIndexSignature: true | ||
plugins: | ||
- typescript | ||
- typescript-resolvers | ||
src/generated/client.tsx: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- keep using client graphql code gen for React Hooks etc.
@@ -47,12 +46,13 @@ | |||
"b64-to-blob": "^1.2.19", | |||
"babel-plugin-import": "^1.13.0", | |||
"babel-plugin-inline-import": "^3.0.0", | |||
"babel-plugin-transform-typescript-metadata": "^0.3.0", | |||
"class-validator": "^0.11.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -84,10 +84,12 @@ | |||
"reflect-metadata": "^0.1.13", | |||
"stripe": "^8.7.0", | |||
"styled-components": "^5.0.0", | |||
"type-graphql": "^0.18.0-beta.16", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- beta usage here, because 0.17 had issues with hot reloading Getting "Schema must contain uniquely named types but contains multiple types named" for a single type MichalLytek/type-graphql#396 (comment)
"dotenv": "^8.2.0", | ||
"file-saver": "^2.0.2", | ||
"firebase": "^7.7.0", | ||
"firebase-admin": "^8.9.1", | ||
"graphql": "^14.5.8", | ||
"graphql-iso-date": "^3.6.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- built-in in TypeGraphQL
const server = new ApolloServer({ | ||
schema, | ||
context: async ({ req, res }): Promise<ResolverContext> => { | ||
const me = await getMe(req, res); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- bonus: changed into middleware
@@ -41,11 +49,15 @@ export const config = { | |||
export default async (req: ServerRequest, res: ServerResponse) => { | |||
const connection = await getConnection(); | |||
|
|||
const schema = await buildSchema({ | |||
resolvers, | |||
dateScalarMode: 'isoDate', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- custom date scalar