{"id":16184611,"url":"https://github.com/rmariuzzo/rachel","last_synced_at":"2025-06-11T11:40:55.263Z","repository":{"id":65478732,"uuid":"109282831","full_name":"rmariuzzo/Rachel","owner":"rmariuzzo","description":"🚀  Quickly create a RESTful client!","archived":false,"fork":false,"pushed_at":"2017-11-04T18:45:56.000Z","size":61,"stargazers_count":7,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"develop","last_synced_at":"2025-02-28T14:11:15.686Z","etag":null,"topics":["restful-client"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rmariuzzo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-11-02T15:25:43.000Z","updated_at":"2018-09-25T02:31:09.000Z","dependencies_parsed_at":"2023-01-25T15:15:57.901Z","dependency_job_id":null,"html_url":"https://github.com/rmariuzzo/Rachel","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rmariuzzo%2FRachel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rmariuzzo%2FRachel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rmariuzzo%2FRachel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rmariuzzo%2FRachel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rmariuzzo","download_url":"https://codeload.github.com/rmariuzzo/Rachel/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243960435,"owners_count":20375102,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["restful-client"],"created_at":"2024-10-10T07:10:43.718Z","updated_at":"2025-03-19T02:31:19.217Z","avatar_url":"https://github.com/rmariuzzo.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=center\u003e\n  \u003ch1\u003eRachel\u003c/h1\u003e\n  \u003csmall\u003e\n    \u003cstrong\u003eR\u003c/strong\u003eESTful\n    \u003cstrong\u003eA\u003c/strong\u003ePI \n    \u003cstrong\u003eC\u003c/strong\u003elient\n    \u003cstrong\u003ehel\u003c/strong\u003eper\n  \u003c/small\u003e\n  \u003cp\u003e🚀 Quickly create a RESTful client!\u003cp\u003e\n\u003c/div\u003e\n\n## Install\n\n - **NPM**: `npm install rachel --save`\n - **Yarn**: `yarn add rachel`\n\n **Dependency:** **Rachel** is built on top of `fetch` you will need to [install it](https://github.com/matthew-andrews/isomorphic-fetch).\n\n## Features\n\n - **Under 4KB!** (1.17KB gziped).\n - **2 dependencies:**: `fetch` and `Promise`.\n - **Builds:** CommonJS, ES and UMD.\n - **JSON** by default!\n\n## Example\n\n```js\n// api.js\nimport Rachel from 'rachel'\n\nconst api = Rachel.createApi(baseUrl, options)\n\nexport default {\n  users: {\n    list: api.list('/users'),\n    get: api.get('/users/:id'),\n    post: api.post('/users'),\n    put: api.put('/users/:id'),\n    del: api.del('/users/:id'),\n  }\n}\n```\n\n```js\n// main.js\nimport api from './api'\n\napi.users.list()         // GET:    /users\napi.users.get(123)       // GET:    /users/123\napi.users.post(user)     // POST:   /users     { \"name\": \"foo\" }\napi.users.put(123, user) // PUT:    /users/123 { \"name\": \"bar\" }\napi.users.del(123)       // DELETE: /users/123\n```\n\n## Documentation\n\n### `createApi`\n\nCreate an API wrapper with options.\n\n```js\nrachel.createApi(baseUrl, options)\n```\n - `baseUrl` - `String`. **Required.** The base URL.\n - `options` - `Object`. _Optional_. [Request options](#request-options) that will be transfered to all methods (`list`, `get`, `post`, `put` and `del`).\n   - `prefix` - `String`. The prefix to add to all API requests.\n\n## `list`\n\nPrepare a `GET` request function that will list all items of a resource.\n\n```js\nrachel.list(path, options)\n```\n\n - `path` - `String`. **Required**. [URI path pattern](#uri-path-pattern).\n - `options` - `Object`. _Optional_. [Request options](#request-options).\n\n**Returns:** `Function`. A function that accept one argument:\n - `options` - `Object`. _Optional_. [Request options](#request-options)\n\n## `get`\n\nPrepare a `GET` request function that will obtain a single resource by its identifier.\n\n```js\nrachel.get(path, options)\n```\n\n - `path` - `String`. **Required**. [URI path pattern](#uri-path-pattern).\n - `options` - `Object`. _Optional_. [Request options](#request-options).\n\n**Returns:** `Function`. A function that accept two arguments:\n - `id` - `Object`. **Required**. The resource identifier. \n - `options` - `Object`. _Optional_. [Request options](#request-options)\n\n## `post`\n\nPrepare a `POST` request function that will create a new resource.\n\n```js\nrachel.post(path, options)\n```\n\n - `path` - `String`. **Required**. [URI path pattern](#uri-path-pattern).\n - `options` - `Object`. _Optional_. [Request options](#request-options).\n\n**Returns:** `Function`. A function that accept two arguments:\n - `data` - `Object`. **Required**. The data of the resource to create.\n - `options` - `Object`. _Optional_. [Request options](#request-options)\n\n## `put`\n\nPrepare a `PUT` request function that will update an existing resource.\n\n```js\nrachel.put(path, options)\n```\n - `path` - `String`. **Required**. [URI path pattern](#uri-path-pattern).\n - `options` - `Object`. _Optional_. [Request options](#request-options).\n\n**Returns:** `Function`. A function that accept three arguments:\n - `id` - `Object`. **Required**. The resource identifier.\n - `data` - `Object`. **Required**. The resource to be updated.\n - `options` - `Object`. _Optional_. [Request options](#request-options)\n\n## `del`\n\nPrepare a `DELETE` request function that will delete an existing resource\n\n```js\nrachel.del(path, options)\n```\n\n - `path` - `String`. **Required**. [URI path pattern](#uri-path-pattern).\n - `options` - `Object`. _Optional_. [Request options](#request-options).\n\n**Returns:** `Function`. A function that accept two arguments:\n - `id` - `Object`. **Required**. The resource identifier.\n - `options` - `Object`. _Optional_. [Request options](#request-options)\n\n### URI path pattern\n\nAn URI path pattern is a `String` that contains placeholders. For example: '/users/:id' is an URI pattern that contain a placeholder (`:id`). **Rachel** interpret strings that starts with `:` as placeholders that will be replaced with an identifier or a data object.\n\n | URI path pattern | `id`  | `data`            | Result       |\n | ---------------- | ----- | ----------------- | ------------ |\n | `/users/:id`     | `123` |                   | `/users/123` |\n | `/roles/:name`   |       | `{ name: 'foo' }` | `/roles/foo` |\n | `/users/:id`     | `123` | `{ id: 456 }`     | `/users/123` |\n\n\u003e 💁 **Rachel** prioritize identifiers over data objects.\n\n### Request Options\n\n - `baseUrl` - `String`. **Default: `null`**. The base URL.\n - `prefix` - `String`. **Default: `null`**. The prefix to add to all API requests.\n - `cache` - `Boolean`. **Default: `false`**. Indicate if the request should be cached.\n - `multiple` - `Boolean`. **Default: `true`**. Indicate if the request can be issued multiple times, if `false` all subsequent request will return the same promise.\n - `extract` - `String`. **Default: `null`**. The field name of the value to extract from the JSON response.\n\n## Development\n\n - `yarn build` - Build production assets.\n\n\n## Tests\n\n - `yarn test` - Run all tests.\n - `yarn test -- --watch` - Run all tests in watch mode.\n\n\u003cdiv align=center\u003e\n  \u003cp\u003eMIT License\u003c/p\u003e\n  \u003cp\u003eCreated with ❤️ by \u003ca href=\"https://github.com/rmariuzzo\"\u003eRubens Mariuzzo\u003c/a\u003e\u003c/p\u003e\n  \u003csmall\u003eAmelie \u003cstrong\u003eRachel\u003c/strong\u003e – my first born daughter\u003c/small\u003e\n\u003c/div\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frmariuzzo%2Frachel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frmariuzzo%2Frachel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frmariuzzo%2Frachel/lists"}