Nerfing Powerful Megalomaniacs

    make-graphql-query

    1.0.0 • Public • Published

    make-graphql-query

    The point of this library is to have a super simple way to make graphql queries that is framework agnostic.pub

    • install npm install make-graphql-query

    • create your query function

    const makeGraphQLQuery = require("make-graphql-query");
    
    const graphQLQuery = makeGraphQLQuery({
      url: "xxxxxxxxxxxxxxxxxxxx.hasura.app/v1/graphql",
      headers: {
        "x-hasura-admin-secret":
          "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
      },
    });
    • make your queries or mutation, first argument takes two properties as arguments, query and variables (for graphql variables).
    graphQLQuery({
      query: `{
            habits {
              id
              habit
              count
            }
          }`,
    })
    .then(data => console.log(data.habits))

    Keywords

    Install

    npm i make-graphql-query

    DownloadsWeekly Downloads

    5

    Version

    1.0.0

    License

    ISC

    Unpacked Size

    3.11 kB

    Total Files

    5

    Last publish

    Collaborators

    • alexmerced