{"id":15314252,"url":"https://github.com/barelyhuman/fit","last_synced_at":"2025-10-08T23:33:22.842Z","repository":{"id":42713688,"uuid":"279982864","full_name":"barelyhuman/fit","owner":"barelyhuman","description":"Minimal wrapper around window.fetch to make my life easier","archived":true,"fork":false,"pushed_at":"2022-03-27T15:26:35.000Z","size":94,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-12-09T06:36:34.148Z","etag":null,"topics":["client","fetch","http","javascript"],"latest_commit_sha":null,"homepage":"","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/barelyhuman.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-07-15T21:26:37.000Z","updated_at":"2023-01-28T00:11:09.000Z","dependencies_parsed_at":"2022-09-06T20:31:29.638Z","dependency_job_id":null,"html_url":"https://github.com/barelyhuman/fit","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/barelyhuman%2Ffit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/barelyhuman%2Ffit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/barelyhuman%2Ffit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/barelyhuman%2Ffit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/barelyhuman","download_url":"https://codeload.github.com/barelyhuman/fit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235775522,"owners_count":19043180,"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":["client","fetch","http","javascript"],"created_at":"2024-10-01T08:44:52.546Z","updated_at":"2025-10-08T23:33:17.551Z","avatar_url":"https://github.com/barelyhuman.png","language":"JavaScript","readme":"\u003ch1 align=\"center\"\u003e\nFit\n\u003c/h1\u003e\n\u003cp align=\"center\"\u003eMinimal functional style wrapper around fetch to make my life a little more easier\u003c/p\u003e\n\n## Install\n\n```sh\nnpm i @barelyhuman/fit\n```\n\n## Usage\n\nFit has a very simple and modular API\n\n```js\nimport {create, createImmediate} from '@barelyhuman/fit'\n\n// create allows you to well \"create\" a baseURL based\n// instance of the fetcher module\nconst simpleFetcher = create('https://api.example.com')\n\n// for cases where you don't need the baseURL form of functionality\n// you can use `createImmediate` instead\nconst immediateFetcher = createImmediate(\n\t'https://api.example.com/posts/1',\n\twindow.fetch,\n).get()\n\n// a simple GET request\nconst response = await simpleFetcher(`posts/${id}`).get()\n\n// a simple POST request\nconst response = await simpleFetcher(`posts`).post({\n\tuserId: 1,\n\ttitle: 'Hello',\n\tbody: 'New content',\n})\n\n// you can pass an optional fetch if using it anywhere other than the browser\nimport nodeFetch from 'node-fetch'\n\nconst fetcherNode = create('https://api.example.com', nodeFetch)\n```\n\n#### Examples\n\nThis is a simple demonstration based on what I use the library for\n\n```js\nimport {create} from '@barelyhuman/fit'\n\nconst fetcher = create('https://api.example.com')\n\nconst postsSDK = (id?: string | number) =\u003e {\n\tlet url = `/api/posts`\n\n\tif (id) {\n\t\turl += `/${id}`\n\t}\n\n\treturn fetcher(url)\n}\n\nconst getPostById = id =\u003e {\n\treturn postsSDK(id).get()\n}\n\nconst createPost = payload =\u003e {\n\treturn postsSDK().post(payload)\n}\n\nconst updatePost = (id, payload) =\u003e {\n\treturn postsSDK(id).put(payload)\n}\n\nconst deletePost = id =\u003e {\n\treturn postsSDK(id).delete()\n}\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbarelyhuman%2Ffit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbarelyhuman%2Ffit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbarelyhuman%2Ffit/lists"}