This is a GraphQL server application to be used with a sibling React application for demo and training purposes. This application has a simple schema for the display of a handful of Marvel Villain characters. After installation, you can view the GraphQL API UI for testing at http://localhost:8082/graphiql. The endpoint path to target from an external application is http://localhost:8082/graphql
.
- Express
- GraphQL
- GraphQL Tools
- Apollo Server Express
- Babel transpiling
- Install yarn or also use
npm
for dependencies. - Install packages with
yarn install
ornpm install
- Run the server with
yarn start
ornpm start
and visithttp://localhost:8082
The GraphQL API UI will provide a method to test queries, which you can then replicate in our secondary application. Below are some quick schema constructs which have been added by default.
{
characters {
id
name
description
image
comics {
id
title
image
description
sales {
issue
count
}
}
}
}
mutation CreateCharacter($input: CharacterName!) {
createCharacter(input: $input) {
id
name
description
image
comics {
id
title
image
description
sales {
issue
count
}
}
}
}
(query variable)
{
"input": {
"name": "Arcade"
}
}
mutation UpdateCharacter($input: CharacterName!) {
createCharacter(input: $input) {
name
description
}
}
(query variable)
{
"input": {
"name": "Arcade"
}
}
{
marvel {
name
}
}
{
pokemons {
id
nid
pokemon_id
title
back_shiny_sprite
front_shiny_sprite
height_pokemon
weight_pokemon
hp
attack
defense
special_attack
special_defense
speed
abilities {
id
type
name
description
}
ref_types {
id
type
name
description
}
}
}
{
pokemon(nid:27) {
id
nid
pokemon_id
title
back_shiny_sprite
front_shiny_sprite
height_pokemon
weight_pokemon
hp
attack
defense
special_attack
special_defense
speed
abilities {
id
type
name
description
}
ref_types {
id
type
name
description
}
}
}
{
users {
name
email
first_name
last_name
email
country
id
}
}