restQL integrates seamlessly with your current microservice architecture.

There is no need of any implementation server side, just configure the service endpoints, run restQL server and start querying.

What can you do with restQL?

You can find below some restQL features and how they compare to a manual javascript implementation.

Parallel calls

restQL builds a dependency graph and will perform parallel invocations of the listed resources.

restQL

from hero
    with
        name = "Restman"

from villain
    with
        name = "SOAPLord"

javascript

  function loadData() {

    const heroPromise = loadHero({name: "Restman"})
    const villainPromise = loadVillain({name: "SOAPLord"})

    return Promise.all([heroPromise, villainPromise])
      .then(([hero, villain]) => ({
        hero: hero,
        villain: villain
      })

  }

Chained invocations

When you have a service that depends on an information from a previous service restQL will delay the execution of the second service until the first completes.

restQL

from hero
    with
        name = "Restman"

from sidekick
    with
        hero = hero.id

javascript

function loadData() {

  const heroPromise = loadHero({name: "Restman"})

  const sidekickPromise = heroPromise.then(hero => 
                            loadSidekick({heroId: hero.id}))

  return Promise.all([heroPromise, sidekickPromise])
    .then(([hero, sidekick]) => ({
      hero: hero,
      sidekick: sidekick
    })

}

Multiplexed invocations

Sometimes there's a need to retrieve a list from a service and then for each item from that list invoke another service. By default restQL considers lists as multiplexed invocations and will make a request for each item.

restQL

from search
    with
        role = "hero"

from hero as heroes
    with
        name = search.results.name

javascript

function loadData() {

  const searchPromise = loadSearch({role: "hero"})

  const heroesPromise = searchPromise.then(search => {
    const heroes = search.map(item => loadHero({name: item.name})
    return Promise.all(heroes)
  })

  return Promise.all([searchPromise, heroesPromise])
    .then(([search, heroes]) => ({
      search: search,
      heroes: heroes
    }))

}

Filtering

restQL allows to specify which fields should be fetched for each resource. This enables reduced payload, which is critical to mobile clients.

restQL

  from heroes as hero
      with
          name = "restQL Master"
      only
          skills,
          name,
          archEnemy
Fork me on GitHub