Your First Query


In order to start using RapidQL, you must install the NPM package. This can be done either by cloning with git or by using npm.

npm install rapidql

The -g flag is necessary to run from the command line (see CLI Installation & Basic Usage)


After requiring the RapidQL package, you can initialize it. You may also pass options, such as HTTP default parameters or DB Connection Variables.

const RapidQL = require('RapidQL');
let rql = new RapidQL({
    Http : {
        X-RapidAPI-Header: '***********'


You can perform queries using the method rql.query(). It takes 2 arguments: a

  1. The query string
  2. [optional] A base context. You may use the base context for parameter passing (any parameters such as user name used in the query should be passed through the base context. The query string should be completely static).

Queries return promises. If the promise rejects, the returned value will be the error message. If the query resolves, the returned value will be the query result.

//Running this query on this base context will return the object {a:1}
rql.query(`{a}`, {
    a: 1,
    b: 2