All Projects → adjesusds → restql

adjesusds / restql

Licence: MIT license
RESTful API Resolver for Nested-Linked Resources | 🕸 🕷

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to restql

zsh-yarn-completions
Yarn completions for Z-shell that supports yarn workspaces
Stars: ✭ 35 (+118.75%)
Mutual labels:  yarn
monorepo-utils
A collection of utilities for monorepo/lerna. Tools for TypeScript project references etc..
Stars: ✭ 143 (+793.75%)
Mutual labels:  yarn
flink-spark-submiter
从本地IDEA提交Flink/Spark任务到Yarn/k8s集群
Stars: ✭ 157 (+881.25%)
Mutual labels:  yarn
erupt-web
Erupt 框架前端源码,实现了 erupt 开发过程中零前端代码能力
Stars: ✭ 82 (+412.5%)
Mutual labels:  yarn
dtsearch
Find packages with TypeScript types, either bundled or on Definitely Typed
Stars: ✭ 24 (+50%)
Mutual labels:  yarn
composer-asset-compiler
Composer plugin that installs dependencies and compiles assets based on configuration.
Stars: ✭ 19 (+18.75%)
Mutual labels:  yarn
introduction-nodejs
Introduction to NodeJS
Stars: ✭ 13 (-18.75%)
Mutual labels:  yarn
MacOS-All-In-One-Update-Script
Mac update shell script (Appstore, macOS, Homebrew and others)
Stars: ✭ 39 (+143.75%)
Mutual labels:  yarn
package-info.nvim
✍️ All the npm/yarn commands I don't want to type
Stars: ✭ 248 (+1450%)
Mutual labels:  yarn
yall
Yarn/npm for monorepos
Stars: ✭ 27 (+68.75%)
Mutual labels:  yarn
ansible-role-yarn
Install Yarn via Ansible to Ubuntu and RedHat systems!
Stars: ✭ 20 (+25%)
Mutual labels:  yarn
koa-mongoDB
😊😊Koa and mongoose build services
Stars: ✭ 24 (+50%)
Mutual labels:  yarn
cimg-node
The CircleCI Node.js Docker Convenience Image.
Stars: ✭ 35 (+118.75%)
Mutual labels:  yarn
express-starter
ARCHIVED: Please use @neutrinojs/create-project
Stars: ✭ 14 (-12.5%)
Mutual labels:  yarn
beanszoo
Distributed Java micro-services using ZooKeeper
Stars: ✭ 12 (-25%)
Mutual labels:  yarn
Forward-Framework
A killer WordPress theme framework built using underscores, gulp, sass, bourbon neat, bower & browsersync.
Stars: ✭ 23 (+43.75%)
Mutual labels:  yarn
studybuddy-web
📚 Website for all the study materials for IIITV curriculums 🎉
Stars: ✭ 17 (+6.25%)
Mutual labels:  yarn
marayarn
Marathon on yarn
Stars: ✭ 13 (-18.75%)
Mutual labels:  yarn
graphql-dependency
Cross service dependencies for GraphQL API with underlying @imqueue services
Stars: ✭ 17 (+6.25%)
Mutual labels:  resolver
awesome-env-config-cn
各种开发语言项目环境国内(中国国内加速镜像)配置教程和部分实践经验,包括github.com, nodejs,npm,nvm, yarn, java, maven, gradle, python, mysys2, elasticsearch, php,golang等等,更多正在加入中...
Stars: ✭ 50 (+212.5%)
Mutual labels:  yarn

RestQL.js

RESTful API Resolver for Nested-Linked Resources | 🕸 🕷


npm build maintainability coverage code style

RestQL allows you to dynamically resolve the nested-linked resources of a RESTful API.

By specifying a set of properties to describe the paths.

Installation

npm

npm install restql --save

Yarn

yarn add restql

CDN

<script src="https://unpkg.com/restql/dist/umd/index.min.js"></script>

Parameters

resource

{string} The resource to fetch.

Description

Self-explanatory.

e.g.:

'https://pokeapi.co/api/v2/pokemon/1/'

resolver

{Object} The resolver to apply.

Description

At each level, each property describes a path to the nested resources within the current one.

RestQL resolves the sames and call the subsequent resolver against them...

Until the base case (null) is reached; from which it returns back the merged responses.

Quantifiers

Following is a table of the quantifiers you can use:

Quantifier Description
[] Collection of properties.
? Optional property.

e.g.:

{
  'abilities[]?.ability.url': {
    'generation.url': {
      'main_region.url': null,
    },
  },
  'stats[].stat.url?': {
    'affecting_natures.increase[].url': null,
    'affecting_natures.decrease[].url': null,
  },
  'moves[].move?.url': null,
}

[options]

{Object} The options to bypass.

Description

Request Config

e.g.:

{
  // ...
}

Usage

// External Packages
import restql from 'restql'

/**
 * @constant {string} resource The resource to fetch.
 */
const resource = 'https://pokeapi.co/api/v2/pokemon/1/'

/**
 * @constant {Object} resolver The resolver to apply.
 */
const resolver = {
  'abilities[]?.ability.url': {
    'generation.url': {
      'main_region.url': null,
    },
  },
  'stats[].stat.url?': {
    'affecting_natures.increase[].url': null,
    'affecting_natures.decrease[].url': null,
  },
  'moves[].move?.url': null,
}

/**
 * @constant {Object} options The options to bypass.
 */
const options = {
  // ...
};

(async () => {
  try {
    const data = await restql(resource, resolver, options)

    console.log(data)
  } catch (error) {
    console.error(error.message)
  }
})()

Test RestQL in your browser.

Roadmap

  • Support for authentication
  • Support for optional resolvers
  • Improve package bundler
  • Ability to cache responses
  • Support for recursive resolvers

Take 🍰, Folks! 🌮 🐴 💨

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].