Unleash awesomeness. Private packages, team management tools, and powerful integrations. Get started with npm Orgs »

jraph

1.3.0 • Public • Published

jraph

A simple fetch-wrapper for making GraphQL API calls in a jiff!

jraph is written in typescript, but can be used in both a VanillaJS and a TypeScript context.

|   Note that for the purposes of this project, we will use sample data from an ApolloGraphQL API I created on CodeSandbox, check it out by clicking the button below.

Edit GraphQL Example API

VanillaJS Examples

Queries

    import {jraph} from 'jraph';
 
    async function getItems(){
        return jraph({
            url: "https://csb-xpwq1o2824-xravvsjkul.now.sh/",
            options: {
                method: "POST"
            },
            query: `
            query{
                items{
                    title
                    info
                }
            }
            `
        });
    }

Mutations

    import {jraph} from 'jraph';
 
    async function addItems(){
        return jraph({
            url: "https://csb-xpwq1o2824-xravvsjkul.now.sh/",
            options: {
                method: "POST"
            },
            query: `
            mutation{
                addItem(id: 1, title: "jraph", info: "A Minimal fetch-wrapper for making GraphQL queries!"){
                    title
                    info
                }
            }
            `
        });
    }

typescript example coming soon

install

npm i jraph

Downloadsweekly downloads

2

version

1.3.0

license

MIT

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability