An open API service indexing awesome lists of open source software.

https://github.com/serrexlabs/graphqlc

Simple GraphQL client
https://github.com/serrexlabs/graphqlc

Last synced: about 2 months ago
JSON representation

Simple GraphQL client

Awesome Lists containing this project

README

        

Super simple graphql client

```ts
import { create } from './src';

const client = create({
url: 'https://api.graphql.jobs/',
headers: {
Authorization: `Bearer ${token}`
}
});

interface Response {
readonly data: T;
}

interface CompanyResponse {
companies: Array;
remotes: Array;
}

interface Company {
name: string;
}

interface Remote {
type: string;
slug: string;
}

const query = `query jobs {
remotes{
type,
slug
},
companies {
name
}
}`;

const fetchData = async () => {
const {
data: { companies, remotes },
} = await client.query>(query, {});
console.log(companies[0].name);
console.log(remotes[0].type);
};

console.log('yooooo');

fetchData();

```