{"id":23283554,"url":"https://github.com/leandromatos/nuxt-cookie","last_synced_at":"2025-08-21T15:33:41.993Z","repository":{"id":57126544,"uuid":"310073996","full_name":"leandromatos/nuxt-cookie","owner":"leandromatos","description":"The Cookie Module for Nuxt, works perfectly on the client side and on the server side for set, get and remove cookies.","archived":false,"fork":false,"pushed_at":"2020-11-04T18:06:24.000Z","size":226,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-09T02:07:14.216Z","etag":null,"topics":["cookie","javascript","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/leandromatos.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}},"created_at":"2020-11-04T17:37:48.000Z","updated_at":"2023-07-07T08:06:55.000Z","dependencies_parsed_at":"2022-08-24T14:59:38.861Z","dependency_job_id":null,"html_url":"https://github.com/leandromatos/nuxt-cookie","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/leandromatos%2Fnuxt-cookie","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leandromatos%2Fnuxt-cookie/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leandromatos%2Fnuxt-cookie/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leandromatos%2Fnuxt-cookie/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leandromatos","download_url":"https://codeload.github.com/leandromatos/nuxt-cookie/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230508022,"owners_count":18237108,"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":["cookie","javascript","nuxt","nuxt-module","nuxtjs"],"created_at":"2024-12-20T01:22:25.179Z","updated_at":"2024-12-20T01:22:26.081Z","avatar_url":"https://github.com/leandromatos.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🍪 Nuxt Cookie\n\n\u003c!-- [![npm version][npm-version-src]][npm-version-href]\n[![npm downloads][npm-downloads-src]][npm-downloads-href]\n[![Github Actions CI][github-actions-ci-src]][github-actions-ci-href]\n[![Codecov][codecov-src]][codecov-href]\n[![License][license-src]][license-href] --\u003e\n\n\u003e The Cookie Module for [Nuxt](https://nuxtjs.org/), works perfectly on the client side and on the server side for set, get and remove cookies.\n\n[📖 **Release Notes**](./CHANGELOG.md)\n\n## Setup\n\nAdd `@leandromatos/nuxt-cookie` dependency to your project.\n\n```bash\nyarn add @leandromatos/nuxt-cookie\n```\n\nor\n\n```bash\nnpm install @leandromatos/nuxt-cookie\n```\n\nAdd `@leandromatos/nuxt-cookie` to the `modules` section of `nuxt.config.js`.\n\n```js\n{\n  modules: ['@leandromatos/nuxt-cookie']\n}\n```\n\n## Usage\n\nAfter add the module on your project, you can access it through the `$cookie`.\n\n### Set a cookie\n\n`$cookie.set(name, value, options)`\n\n- `name` (string): Cookie name.\n- `value` (string orobject|array|boolean): Cookie value.\n- `options` (object): Same options as the [cookie.serialize](https://github.com/jshttp/cookie#cookieserializename-value-options) method of the [cookie module](https://github.com/jshttp/cookie).\n\nUsage on server-side:\n\n```js\n// Nuxt middleware\nexport default ({ app: { $cookie } }) =\u003e {\n  $cookie.set('cookie-name', 'server-cookie-value', {\n    path: '/',\n  })\n})\n```\n\nUsage on client-side:\n\n```js\n// Vue component\nexport default {\n  mounted() {\n    this.$cookie.set('cookie-name', 'client-cookie-value', {\n    path: '/',\n  })\n  }\n}\n```\n\n### Get a cookie\n\n`get(name)`\n\n- `name` (string): Cookie name.\n\n```js\n// Nuxt middleware\nexport default ({ app: { $cookie } }) =\u003e {\n  const cookie = $cookies.get('cookie-name')\n}\n```\n\n```js\n// Vue component\nexport default {\n  mounted() {\n    const cookie = this.$cookie.get('cookie-name')\n  }\n}\n```\n\n### Remove a cookie\n\n`remove(name, options)`\n\n- `name` (string): Cookie name.\n- `options` (object): Same options as the [cookie.serialize](https://github.com/jshttp/cookie#cookieserializename-value-options) method of the cookie module\n\n```js\n// Nuxt middleware\nexport default ({ app: { $cookie } }) =\u003e {\n  const cookie = $cookies.remove('cookie-name')\n}\n```\n\n```js\n// Vue component\nexport default {\n  mounted() {\n    const cookie = this.$cookie.remove('cookie-name')\n  }\n}\n```\n\n## Development\n\n- Clone this repository\n- Install dependencies using `yarn install` or `npm install`\n- Start development server using `yarn run dev` or `npm run dev`\n\n## License\n\n[MIT License](./LICENSE)\n\nCopyright (c) Leandro Matos \u003ccontato@leandromatos.com.br\u003e\n\n\u003c!-- Badges --\u003e\n\n\u003c!-- [npm-version-src]: https://img.shields.io/npm/v/@leandromatos/nuxt-cookie/latest.svg\n[npm-version-href]: https://npmjs.com/package/@leandromatos/nuxt-cookie\n[npm-downloads-src]: https://img.shields.io/npm/dt/@leandromatos/nuxt-cookie.svg\n[npm-downloads-href]: https://npmjs.com/package/@leandromatos/nuxt-cookie\n[github-actions-ci-src]: https://github.com/leandromatos/nuxt-cookie/workflows/ci/badge.svg\n[github-actions-ci-href]: https://github.com/leandromatos/nuxt-cookie/actions?query=workflow%3Aci\n[codecov-src]: https://img.shields.io/codecov/c/github/leandromatos/nuxt-cookie.svg\n[codecov-href]: https://codecov.io/gh/leandromatos/nuxt-cookie\n[license-src]: https://img.shields.io/npm/l/@leandromatos/nuxt-cookie.svg\n[license-href]: https://npmjs.com/package/@leandromatos/nuxt-cookie --\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleandromatos%2Fnuxt-cookie","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleandromatos%2Fnuxt-cookie","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleandromatos%2Fnuxt-cookie/lists"}