GraphQL API plugged into the old MySQL database of JeuxAmateurs (French website about amateur games).
Disclaimer: This was an experimentation to understand better how you can easily build a GraphQL schema using available tools. Of course, it isn't very optimized at all but I hope with this you can be inspired.
Load structure.sql
, fill it with data and run npm install && npm start
. Here's your GraphQL API!. Note that the structure is old and ugly, for testing and posterity only!
GraphQL comments above the line can be used for documenting directly. Take a look at this:
# My awesome type
type User {
# This is a username
username: String!
# I shouldn't have exposed this
password: String!
}
And the result in the GraphiQL editor: .
Yes it is possible and it means that the array shouldn't be null when you query it.
So [Type]!
means you always get an array (empty or not), [Type!]
is for a non-empty array or null
, [Type!]!
is always a non-empty array. Fun!