✨ Super simple guide on building GraphQL server using ExpressJS
yarn add graphql express graphql-express
yarn start
yarn dev
Ngopract release iteration consists of several branches (01-, 02-, etc) to ensure the best "ngopract" experience.
- 01-Simple GraphQL Query, simple getting started with query using an in-memory global variable fake database
sample query
query {
students {
name
parentName
}
}
- 02-Simple GraphQL Query and Mutation, simple getting started with query and mutation
sample mutation query
mutation CreateStudent($newStudent: NewStudentInput!) {
createStudent(input: $newStudent) {
name
age
score
}
}
query variables for mutation
{
"newStudent": {
"name": "wawan",
"age": 18,
"score": 20,
"parentName": "dodo"
}
}
-
03- GraphQL Query, the end result is the same as step 01, but built without using
buildSchema
method and use GraphQLObject instead. -
04- GraphQL Query and Mutation, the end result is the same as step 02, but built without using
buildSchema
method and use GraphQLObject instead. -
05- GraphQL Async Query, continuation on previous step, with asynchronous "data fetching" using simple setTimeout