{"id":16957938,"url":"https://github.com/joshnuss/svelte-http-store","last_synced_at":"2025-04-11T21:52:45.274Z","repository":{"id":152473541,"uuid":"622398339","full_name":"joshnuss/svelte-http-store","owner":"joshnuss","description":"A Svelte store backed by the fetch API","archived":false,"fork":false,"pushed_at":"2023-04-02T02:49:07.000Z","size":38,"stargazers_count":19,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-11T21:52:41.131Z","etag":null,"topics":["fetch","http","svelte","svelte-store"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/joshnuss.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-04-02T01:38:56.000Z","updated_at":"2024-02-28T14:28:15.000Z","dependencies_parsed_at":null,"dependency_job_id":"0fc9298c-ae74-465d-a5d6-57923e661f8a","html_url":"https://github.com/joshnuss/svelte-http-store","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joshnuss%2Fsvelte-http-store","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joshnuss%2Fsvelte-http-store/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joshnuss%2Fsvelte-http-store/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joshnuss%2Fsvelte-http-store/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/joshnuss","download_url":"https://codeload.github.com/joshnuss/svelte-http-store/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248487733,"owners_count":21112188,"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":["fetch","http","svelte","svelte-store"],"created_at":"2024-10-13T22:20:40.601Z","updated_at":"2025-04-11T21:52:45.247Z","avatar_url":"https://github.com/joshnuss.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# svelte-http-store\n\nA [Svelte store](https://svelte.dev/docs#run-time-svelte-store) backed by the [`fetch`](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) API.\n\n## Installation\n\n```sh\npnpm install -D svelte-http-store\n```\n\n## Example\n\n```javascript\n// in src/lib/stores/cart.js\nimport { httpStore } from 'svelte-http-store'\n\n// performs a `GET /cart` request\nexport const cart = httpStore('/cart')\n\n// store.refresh() will request `GET /cart` again\ncart.refresh()\n\n// call store.fetch() to mutate:\ncart.fetch('/cart', { method: 'PATCH' })\n```\n\nFeel free to wrap the `store.fetch()` with functions that fit your domain:\n\n```javascript\n// example: function to add items to the cart\ncart.add = ({ product, quantity }) =\u003e {\n  const url = `/cart/${product.id}`\n  const body = JSON.stringify({ quantity })\n\n  cart.fetch(url, { method: 'POST', body })\n}\n\n// example: function to clear the cart\ncart.clear = () =\u003e {\n  cart.fetch('/cart', { method: 'DELETE' })\n}\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoshnuss%2Fsvelte-http-store","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjoshnuss%2Fsvelte-http-store","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoshnuss%2Fsvelte-http-store/lists"}