From ab7d7780ebd8e21666adf0a0e352eaff07f4749a Mon Sep 17 00:00:00 2001 From: shahrul Date: Wed, 13 Sep 2023 22:07:36 +0800 Subject: [PATCH] update README --- README.md | 33 ++++++++++++++++++++++++++++++++- package.json | 2 +- 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index fe41da1..15f3c89 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Lightweight driven query language [![Coverage Status](https://coveralls.io/repos/github/syarul/requrse/badge.svg?branch=main)](https://coveralls.io/github/syarul/requrse?branch=main) ## What is reQurse -**reQurse** introduces an innovative approach that overcomes the complexities of CRUD operations. The focus is on delivering a streamlined and efficient CRUD library solution, simplifying API development, and effortlessly handling complex data management tasks. **reQurse** utilized JSON-based queries enables you to load data from external configuration files as your numbers of APIs grow, reducing code dependencies and mitigating the need to write lengthy procedural APIs. This approach promotes a modular and streamlined code structure, enhancing flexibility and maintainability. +**reQurse** introduces an innovative approach that overcomes the complexities of CRUD operations. The focus is on delivering a streamlined and efficient CRUD library solution, simplifying API development, and effortlessly handling complex data management tasks. **reQurse** utilized JSON-based queries, allows multi-tenant API sources, avoid writing lengthy procedural APIs and truly embrace Javascript core philosophy as OOP language. This approach promotes a modular and streamlined code structure, retaining the complexity of `Object` tree while enhancing flexibility and maintainability. > This library take some inspirations from NextQL and GraphQL @@ -83,6 +83,37 @@ await queryExec({ }).then(console.log, console.error) // { Test: { test: { person: { name: 'Bar', age: 30 } } } } ``` +Not limited to database queries, you can also manage API endpoints too +```js +queryExec({ + Test: { + test: { + request: { + $params: { + url: 'https://api.github.com/users/douglascrockford' + }, + status: 1, + data: { + id: 1, + login: 1 + } + }, + } + } +}, +{ + methods: { + request: (url) => axios.get(url) + } +}).then(console.log, console.error) +// { +// Test: { +// test: { +// request: { status: 200, data: { id: 262641, login: 'douglascrockford' } } +// } +// } +// } +``` You can add options `config` to map methods with different name. This allow a consistent structure of the query. ```js diff --git a/package.json b/package.json index 3895612..7731231 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@syarul/requrse", - "version": "0.1.5", + "version": "0.1.6", "description": "Lightweight driven query language", "main": "libs/executor.js", "scripts": {