{"id":16347918,"url":"https://github.com/iroy2000/redux-cookie","last_synced_at":"2025-08-09T23:05:10.488Z","repository":{"id":57350448,"uuid":"64334387","full_name":"iroy2000/redux-cookie","owner":"iroy2000","description":"Redux cookie middleware for both client and server ( universal )","archived":false,"fork":false,"pushed_at":"2017-01-14T02:29:15.000Z","size":15,"stargazers_count":16,"open_issues_count":2,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-01T12:22:56.000Z","etag":null,"topics":[],"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/iroy2000.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":"2016-07-27T19:00:23.000Z","updated_at":"2021-01-28T09:57:10.000Z","dependencies_parsed_at":"2022-09-16T21:21:36.704Z","dependency_job_id":null,"html_url":"https://github.com/iroy2000/redux-cookie","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/iroy2000/redux-cookie","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iroy2000%2Fredux-cookie","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iroy2000%2Fredux-cookie/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iroy2000%2Fredux-cookie/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iroy2000%2Fredux-cookie/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iroy2000","download_url":"https://codeload.github.com/iroy2000/redux-cookie/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iroy2000%2Fredux-cookie/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269592078,"owners_count":24443479,"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","status":"online","status_checked_at":"2025-08-09T02:00:10.424Z","response_time":111,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-10-11T00:47:05.372Z","updated_at":"2025-08-09T23:05:10.448Z","avatar_url":"https://github.com/iroy2000.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# redux-cookie\nRedux cookie middleware for both client and server ( universal )\n\n## Build Status\n[![linux build](https://travis-ci.org/iroy2000/redux-cookie.svg?branch=master)](https://travis-ci.org/iroy2000/redux-cookie)\n\n## Note\nSince `version 0.5.6`, this library has changed the action signature \n**from** `cookieSet, cookieGet and cookieExpire` \n**to** `setCookie, getCookie and expireCookie`\n\nBut all the functionality is the same as before. \n\n## Prerequiste\nAssuming you are using a cookie library, like `js-cookie` or your own cookie library implementation.\nMake sure it has `get` and `set` in your cookie library implementation.\n\n## Server Side\n```javascript\nimport {createStore, applyMiddleware} from 'redux';\nimport Cookies from 'cookies';\nimport { createCookieMiddleware } from 'redux-cookie';\nimport {createServer} from 'http';\nimport reducer from './reducer';\n\ncreateServer(function(req, res) {\n    const cookies = new Cookies(req, res);\n    const store = createStore(\n      reducer,\n      applyMiddleware(createCookieMiddleware(cookies))\n    );\n    //...\n}).listen(3000);\n```\n\n## Client Side\n```javascript\nimport Cookies from 'js-cookie';\nimport { createCookieMiddleware } from 'redux-cookie';\nimport reducer from './reducer';\nconst store = createStore(\n  reducer,\n  applyMiddleware(createCookieMiddleware(Cookies))\n);\n```\n\n## Usage\n`redux-cookie` exposes `cookieGet`, `cookieSet` and `cookieExpire`\n\n`cookieGet` takes a \"cookie name\"\n`cookieExpire` takes a \"cookie name\"\n`cookieSet` takes a \"cookie name\", \"cookie value\" and an optional \"options\"  // options like \"expires\" or options support by your cookie library\n\n```javascript\nimport { getCookie, setCookie, expireCookie } from 'redux-cookie';\n\n// !! important \u003e\u003e Remember those are actions, the following just show you what it does\n// Please look at the test file to see examples on how to dispatch the action\n\nsetCookie('cool', 'very cool', { expires: 365 }) // please check your cookie library for what is supported\n\ngetCookie('cool')\n\nexpireCookie('cool')  // expire cookie now\n\n```\n\n**Note:** `redux-cookie` also expose an action `removeCookie` if your library has `remove` implementation, \nif not, it will fall back to `expireCookie`.\n\n`removeCookie` takes a \"cookie name\" and an optional \"options\"\n\n```javascript\nimport { setCookie, removeCookie } from 'redux-cookie';\n\n// !! important \u003e\u003e Remember those are actions, the following just show you what it does\n// If you have question about the usage, please take a look at the test file\n\n// Delete a cookie valid to the path of the current page\nsetCookie('cool', 'very cool', { path: '' })   // if you option has path\n\n// it won't work - fail\nremoveCookie('cool')  // it won't work :(\n\n// it will work - removed\nremoveCookie('cool', { path: '' }) \n\n```\n\n## Configuration\n\nIf you want to prefix your action name\n\n```javascript\nimport Cookies from 'cookies-js';\nimport { createCookieMiddleware } from 'redux-cookie';\nimport reducer from './reducer';\nconst store = createStore(\n  reducer,\n  applyMiddleware(createCookieMiddleware(Cookies, '/redux/cookie/'))\n);\n```\n\n## Known Issues\n\nIf you are creating multiple createCookieMiddle, you cannot use prefix or it will introduce a bug https://github.com/iroy2000/redux-cookie/issues/3.  At the meantime, we are trying to brainstorm the best way to handle this case - https://github.com/iroy2000/redux-cookie/pull/4\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Firoy2000%2Fredux-cookie","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Firoy2000%2Fredux-cookie","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Firoy2000%2Fredux-cookie/lists"}