Built on top of the Rest API
These steps will allow you to run graphql in the GraphQL Playground.
- Clone the repository
git clone ...
cd ...- Install dependencies
With yarn:
yarn install
yarn tsc
yarn playgroundWith npm:
npm install
npm run compile
npm run playground-
Go to
localhost:4000/playground -
Enjoy ^^
/!\ WIP /!\ Package not yet published
Install with npm install --save derpiboru-graphql node-fetch
or yarn add derpiboru-graphql node-fetch
Then use:
import * as fetch from 'node-fetch'
import { DerpibooruGraphql } from 'derpibooru-graphql'
let { gql, query } = new DerpibooruGraphql({ fetch })
// The recommanded way: use the gql tag //
let variables = {}
let result = await gql`
query {
search(query: "cute", per_page: 50) {
total
search {
faves
file_name
score
representations {
full
}
}
}
}
`(varialbles)
console.log(result)
// If you like to have your queries in separate files, use the query function //
// let graphqlQueryText = await fs.promises.readFile('derpiboru-query.gql', 'utf-8')
let graphqlQueryText = `
query {
search(query: "cute", per_page: 50) {
total
search {
faves
file_name
score
representations {
full
}
}
}
}
`
expect(await query(graphqlQueryText)).toEqual(result)