Skip to content

This is a GraphQL example built using NodeJS and ExpressJS

Notifications You must be signed in to change notification settings

Pere970/graphql-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GraphQL Example

This is a GraphQL example built using NodeJS and ExpressJS. It creates a GraphQL server to query for videogames and its publishers.

Development

requires

node >= 12.0

to install node modules

npm i

Run App

After having installed all the modules, run the following command to run a GraphQL server and UI to interact with.

npm run devStart

It'll run a server on the port 5001 and it can be accessed via UI by going to

localhost:5001/graphql

Query Examples

To get all published games only returning its names:

{
    games{
        name
    }
}

To get all game publishers returning its names, ids and published games(only name):

{
    publishers{
        id,
        name,
        games{
            name
        }
    }
}

Mutation Examples

To add a new game to the list and return the name:

mutation {
    addGame(
        name: "GAMENAME",
        publisherId: PUBLISHER_ID (INT)
        ){
            name
        }
}

About

This is a GraphQL example built using NodeJS and ExpressJS

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published