Answers for "how to install graphql using npm"

0

graphql install

npm install graphql --save
Posted by: Guest on October-16-2020
0

command to install express graphql

npm install --save express-graphql
Posted by: Guest on December-26-2021
2

graphql request npm

import { GraphQLClient, gql } from 'graphql-request'

async function main() {
  const endpoint = 'https://api.graph.cool/simple/v1/cixos23120m0n0173veiiwrjr'

  const graphQLClient = new GraphQLClient(endpoint, {
    headers: {
      authorization: 'Bearer MY_TOKEN',
    },
  })

  const mutation = gql`
    mutation AddMovie($title: String!, $releaseDate: Int!) {
      insert_movies_one(object: { title: $title, releaseDate: $releaseDate }) {
        title
        releaseDate
      }
    }
  `

  const variables = {
    title: 'Inception',
    releaseDate: 2010,
  }
  const data = await graphQLClient.request(mutation, variables)

  console.log(JSON.stringify(data, undefined, 2))
}

main().catch((error) => console.error(error))
Posted by: Guest on May-13-2021

Code answers related to "how to install graphql using npm"

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language