{"id":13591642,"url":"https://github.com/patrickcate/nuxt-jsonapi","last_synced_at":"2025-04-07T06:09:56.325Z","repository":{"id":37925199,"uuid":"319832100","full_name":"patrickcate/nuxt-jsonapi","owner":"patrickcate","description":"JSON:API client for Nuxt.js","archived":false,"fork":false,"pushed_at":"2025-03-24T18:33:38.000Z","size":5661,"stargazers_count":43,"open_issues_count":2,"forks_count":9,"subscribers_count":2,"default_branch":"develop","last_synced_at":"2025-03-31T04:07:14.247Z","etag":null,"topics":["json-api","nuxt","nuxt-module","nuxtjs"],"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/patrickcate.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","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":"2020-12-09T03:35:24.000Z","updated_at":"2025-03-24T18:31:11.000Z","dependencies_parsed_at":"2024-01-28T04:20:19.481Z","dependency_job_id":"5828a9d0-658c-4674-b4e3-30246e3dae81","html_url":"https://github.com/patrickcate/nuxt-jsonapi","commit_stats":{"total_commits":402,"total_committers":6,"mean_commits":67.0,"dds":"0.41542288557213936","last_synced_commit":"b3909822c541aa8fc6b851edf2c69fce94f4064c"},"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patrickcate%2Fnuxt-jsonapi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patrickcate%2Fnuxt-jsonapi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patrickcate%2Fnuxt-jsonapi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patrickcate%2Fnuxt-jsonapi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/patrickcate","download_url":"https://codeload.github.com/patrickcate/nuxt-jsonapi/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247601448,"owners_count":20964864,"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":["json-api","nuxt","nuxt-module","nuxtjs"],"created_at":"2024-08-01T16:01:00.096Z","updated_at":"2025-04-07T06:09:56.307Z","avatar_url":"https://github.com/patrickcate.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"![Nuxt JSON:API logo](https://raw.githubusercontent.com/patrickcate/nuxt-jsonapi/main/playground/public/nuxt-jsonapi-logo.svg)\n\n# nuxt-jsonapi\n\n[![npm version][npm-version-src]][npm-version-href] [![npm downloads][npm-downloads-src]][npm-downloads-href] [![Tests](https://github.com/patrickcate/nuxt-jsonapi/actions/workflows/ci.yml/badge.svg)](https://github.com/patrickcate/nuxt-jsonapi/actions/workflows/ci.yml) [![Codecov][codecov-src]][codecov-href] [![License][license-src]][license-href]\n\n\u003e Easy JSON:API client integration for Nuxt.js\n\n[📖 \u0026nbsp; **Release Notes**](./CHANGELOG.md)\n\nVersion `2.x` support Nuxt `3.x`.\n\n[Version `1.x`](https://github.com/patrickcate/nuxt-jsonapi/tree/v1.0.0) supports Nuxt `2.x`\n\n## Introduction\n\n`nuxt-jsonapi` adds easy [JSON:API](https://jsonapi.org) client integration to [Nuxt](https://nuxtjs.org). It is a loose wrapper around the excellent [Kitsu](https://github.com/wopian/kitsu/tree/master/packages/kitsu) JSON:API client.\n\nThis module globally injects a `$jsonApi` instance you can use to access the client anywhere using `this.$jsonApi` (options API) or `const { $jsonApi } = useNuxtApp()` (composition API).\n\n## Setup\n\n1. Add `nuxt-jsonapi` dependency to your project\n\n```bash\nnpm run add nuxt-jsonapi # or npm install nuxt-jsonapi\n```\n\n2. Add `nuxt-jsonapi` to the `modules` section of `nuxt.config.js`\n\n```js\n{\n  modules: [\n    // Simple usage\n    'nuxt-jsonapi',\n\n    // With options\n    [\n      'nuxt-jsonapi',\n      {\n        baseURL: 'http://www.example.com/api',\n        /* other module options */\n      },\n    ],\n  ]\n}\n```\n\n3. If you didn't pass options with step #2, add a `jsonApi` object to your `nuxt.config.js` to configure module options:\n\n```js\nexport default {\n  modules: ['nuxt-jsonapi'],\n\n  jsonApi: {\n    baseURL: 'http://www.example.com/api',\n    /* other module options */\n  },\n}\n```\n\n---\n\n## ❗ Important\n\nIf you do not specify a `baseURL` option, a default `/jsonapi` URL will be used. **This is almost certainly not what you want** so be sure it is set correctly.\n\n---\n\n## Usage\n\nRefer to [Kitsu's excellent documentation](https://github.com/wopian/kitsu/tree/master/packages/kitsu) for all the feature's the client offers.\n\nYou can access the client with:\n\n### Options API\n\n```js\nthis.$jsonApi\n```\n\n**Example:**\n\n```js\nexport default defineNuxtComponent({\n  async asyncData({ $jsonApi }) {\n    const { data } = await $jsonApi.get('/article')\n\n    return {\n      articles: data,\n    }\n  },\n})\n```\n\n### Composition API\n\n```js\nconst { $jsonApi } = useNuxtApp()\n```\n\n**Example:**\n\n```vue\n\u003cscript setup\u003e\nimport { useNuxtApp, useAsyncData } from '#app'\n\nconst { $jsonApi } = useNuxtApp()\n\nconst { data: articles } = await useAsyncData(() =\u003e $jsonApi.get('/article'), {\n  transform: ({ data }) =\u003e data,\n})\n\u003c/script\u003e\n```\n\n## Development\n\n1. Clone this repository\n2. Install dependencies using `yarn install` or `npm install`\n3. Start development server using `yarn dev` or `npm run dev`\n4. Run automated tests using `yarn test` or `npm run test`\n\n- Run `npm run dev:prepare` to generate type stubs.\n- Use `npm run dev` to start [playground](./playground) in development mode.\n\n## License\n\n[MIT License](./LICENSE)\n\nCopyright (c) Patrick Cate\n\n\u003c!-- Badges --\u003e\n\n[npm-version-src]: https://img.shields.io/npm/v/nuxt-jsonapi/latest.svg\n[npm-version-href]: https://npmjs.com/package/nuxt-jsonapi\n[npm-downloads-src]: https://img.shields.io/npm/dt/nuxt-jsonapi.svg\n[npm-downloads-href]: https://npmjs.com/package/nuxt-jsonapi\n[github-actions-ci-src]: https://github.com/patrickcate/nuxt-jsonapi/workflows/ci/badge.svg\n[github-actions-ci-href]: https://github.com/patrickcate/nuxt-jsonapi/actions?query=workflow%3Aci\n[codecov-src]: https://img.shields.io/codecov/c/github/patrickcate/nuxt-jsonapi.svg\n[codecov-href]: https://codecov.io/gh/patrickcate/nuxt-jsonapi\n[license-src]: https://img.shields.io/npm/l/nuxt-jsonapi.svg\n[license-href]: https://npmjs.com/package/nuxt-jsonapi\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpatrickcate%2Fnuxt-jsonapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpatrickcate%2Fnuxt-jsonapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpatrickcate%2Fnuxt-jsonapi/lists"}