howtographql / graphql-js

https://www.howtographql.com/graphql-js/1-getting-started/
363 stars 124 forks source link

createdAt not included in schema.graphql #57

Open ZachCMP opened 5 years ago

ZachCMP commented 5 years ago

Hey,

Thanks for the great tutorial, it was very helpful in learning GraphQL. I actually started the React tutorial first, then decided to come and do this one, as the React one uses this same backend. I thought it would be a much better learning experience to build the backend tutorial first, then use that backend code to build the frontend tutorial. However, I hit a stumbling block immediately upon trying to use my backend code:

In this tutorial, the Link { createdAt } field is only used in the Prisma schema, not in the main API schema. If you download the server starter code listed in the React tutorial, it is is correctly listed in both schemas.

Further, the createdAt type is DateTime, which doesn't seem to be a standard GraphQL type. Using it requires that you declare "scalar DateTime" at the top of your API schema (as seen in the React tut starter). Doing that worked for me with no additional dependencies, but I have no idea why.

Some more clarity on that within the tutorial would be helpful.

jaromb commented 5 years ago

I'll second this. In the backend tutorial for Node, "type Link" in the schema.graphql file is missing the "createdAt:" field, which results in an error when trying to go through the first steps for the front-end tutorial for React+Apollo. I was able to fix the problem by adding that field as follows: createdAt: String!

This should be added as a step after adding the "createdAt" field in the datamodel, as is done in the other steps (modifying the schema in addition to modifying the datamodel) in order to keep all aspects of the schema in agreement with the datamodel.

eseku commented 3 months ago

Just coming accross this problem as well. I guess I would use the starter code as a reference. :)