https://github.com/one-com/grapheetee
https://github.com/one-com/grapheetee
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/one-com/grapheetee
- Owner: One-com
- License: bsd-3-clause
- Created: 2019-11-28T13:55:07.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-11-28T14:37:14.000Z (over 5 years ago)
- Last Synced: 2025-04-13T04:26:35.748Z (about 1 month ago)
- Language: JavaScript
- Size: 18.6 KB
- Stars: 0
- Watchers: 7
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Grapheetee
This module is a clean fetch based GraphQL client.
# Usage
Once installed, the module exposes a constructor at the top-level
that is ready to be instantiated in the browser:```js
import Grapheetee from "grapheetee";const client = new Grapheetee({ url: "/api" });
```Note that a base `url` must be supplied as an option to the constructor.
### Node
Since the client is fetch based, libraries that provide these interfaces
must be provided when the module is used on node. These details are handled
automatically by providing a node ready version of the library:```js
const Grapheetee = require("grapheetee/node");const instance = new Grapheetee({ url: "/my/internal/service" });
```### Requests
Requests are made by calling the `query()` or `mutation()` method on
the client instance:```js
instance.query({
query: "...",
valariables: {
/* optional */
}
});instance.mutation({
query: "...",
valariables: {
/* optional */
},
uploads: [
/* optional */
]
});
```## License
grapheetee is licensed under a standard 3-clause BSD
license -- see the `LICENSE`-file for details.