Skip to content

huckbit/iverb-graphql

Repository files navigation

iVerb graphQL API

A very basic GraphQL API to query english irregular verbs.

Live iVerb API graphiQL URL: https://iverb-graphql.huckbit.com/graphql

How to use

Query the API

Once the server is up and running open GraphiQL at http://localhost:4000/graphql

Get all the verbs

{
  verbs {
    id
    infinitive
    presentParticiple
    past
    pastParticiple
  }
}

Limit number of result

{
  verbs(limit: 10) {
    id
    infinitive
    presentParticiple
    past
    pastParticiple
  }
}

Set start and end for pagination

{
  verbs(start: 20, end: 30) {
    id
    infinitive
    presentParticiple
    past
    pastParticiple
  }
}

Set start / end and limit number of results

{
  verbs(start: 20, end: 30, limit: 5) {
    id
    infinitive
    presentParticiple
    past
    pastParticiple
  }
}

Get verbs that stats with a keyword

{
  verbs(startsWith: "ba") {
    id
    infinitive
    presentParticiple
    past
    pastParticiple
  }
}

Get a random verb

{
  randomVerb {
    id
    infinitive
    presentParticiple
    past
    pastParticiple
  }
}

Get verb by id

graphiql-query

Use the following query

query getVerbById($id: String!) {
  verbByID(id: $id) {
    id
    infinitive
    presentParticiple
    past
    pastParticiple
  }
}

And for example the following for the Query variables

{
  "id": "5eac5bec4ff0d27fa4efa7d2"
}

Get Verb by infinitive

Use the following query

query getVerbByInfinitive($infinitive: String!) {
  verbByInfinitive(infinitive: $infinitive) {
    id
    infinitive
    presentParticiple
    past
    pastParticiple
  }
}

Use for the query variable for example:

{
  "infinitive": "do"
}