/GraphQL-Demo

A simple API developed with express JS for learning GraphQL !!!

Primary LanguageJavaScript

GraphQL Demo wakatime

A simple API developed with express JS for learning GraphQL !!!

  • To use this demo clone this repository or download.

  • Run npm install.

  • Install the following npm packages express, graphql, express-graphql, nanoid.

  • Change the port number if you wish to.

  • Run npm start.

  • Launch browser with the following URL http:localhost:(your port number here...)/graphql

  • To add / modify data (mutation) use the following code

    mutation {
    createCourse(input: {
        courseName: "JS Bootcamp",
        price: 500,
        stack: WEB,
        teachingAssists: [{
            firstName: "Ajay Krishna", lastName: "R",
            experience: 5
            },
            {
              firstName: "Dinesh",
              lastName: "G",
              experience: 6
            }
            ]}) {
                  id
                  courseName
              }
          }
    
  • For getting the specific data use the following code

        query {
            getCourse(id:"(ID generated by nanoID here)"){
            teachingAssists{
                    firstName
                    lastName
                    experience
                }
            }
        }