e-graphql-client
v1.0.12
Published
A modern e-graphql client
Downloads
18
Maintainers
Readme
EGQL
E-GraphQL Client library is the best library to fetch data from backend that run on E-GraphQL Servers. It allows you to easily handle data fetching.
Maintainers
Fetch form the server
import { gql } from 'graphql-request';
import { get } from 'e-graphql-client';
const COUNTRIES_QUERY = gql`
query {
country(code: "IN") {
code
name
continent {
name
}
}
}
`;
const data = await get<{ country: { name: string; code: string } }>(
'https://countries.trevorblades.com/',
COUNTRIES_QUERY,
);
API Reference
| get | url - The Base URL for the E-GraphQL Server. document - The GraphQL query. variables - Variables used in query (optional). requestHeaders - Headers to be sent to the server (optional). | | | | | --- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | --- | --- | --- |
This documentation is a work in progress.