{"id":15097851,"url":"https://github.com/cupcakearmy/koa-cookie","last_synced_at":"2025-10-08T02:31:51.373Z","repository":{"id":57195316,"uuid":"100728443","full_name":"cupcakearmy/koa-cookie","owner":"cupcakearmy","description":"Koa Cookie Utility","archived":true,"fork":false,"pushed_at":"2018-02-25T13:09:17.000Z","size":9,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-09T02:56:46.336Z","etag":null,"topics":["cookie","cookie-parser","cookies","koa","koa-cookie","koa-middleware","parse"],"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/cupcakearmy.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":"2017-08-18T15:58:45.000Z","updated_at":"2023-01-28T10:10:54.000Z","dependencies_parsed_at":"2022-09-16T10:41:19.348Z","dependency_job_id":null,"html_url":"https://github.com/cupcakearmy/koa-cookie","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/cupcakearmy/koa-cookie","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cupcakearmy%2Fkoa-cookie","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cupcakearmy%2Fkoa-cookie/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cupcakearmy%2Fkoa-cookie/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cupcakearmy%2Fkoa-cookie/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cupcakearmy","download_url":"https://codeload.github.com/cupcakearmy/koa-cookie/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cupcakearmy%2Fkoa-cookie/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278877658,"owners_count":26061490,"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-10-08T02:00:06.501Z","response_time":56,"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":["cookie","cookie-parser","cookies","koa","koa-cookie","koa-middleware","parse"],"created_at":"2024-09-25T16:40:55.073Z","updated_at":"2025-10-08T02:31:50.965Z","avatar_url":"https://github.com/cupcakearmy.png","language":"JavaScript","readme":"# koa-cookie\n\n[![npm](https://img.shields.io/npm/v/cca-koa-cookie.svg)](https://www.npmjs.com/package/cca-koa-cookie)\n[![npm](https://img.shields.io/npm/dt/cca-koa-cookie.svg)]()\n[![npm](https://img.shields.io/npm/l/cca-koa-cookie.svg)]()\n[![Travis](https://img.shields.io/travis/CupCakeArmy/koa-cookie.svg)]()\n\nLightweight Koa-Middleware for Cookies\n\n### Install\n```bash\nnpm install cca-koa-cookie --save\n```\n\n### QA\n\nIf you have questions:\n\n[![Join the chat at https://gitter.im/cupcakearmy/koa-cookie](https://badges.gitter.im/cupcakearmy/koa-cookie.svg)](https://gitter.im/cupcakearmy/koa-cookie?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge\u0026utm_content=badge)\n\n### Complete Example\n```javascript\nconst\n\tKoa = require('koa'),\n\tcookie = require('cca-koa-cookie'),\n\trouter = require('cca-koa-router')\n\nconst\n\tapp = new Koa(),\n\tport = 3000\n\napp.use(cookie)\n\napp.use(router({}, _ =\u003e {\n\t_.get('/set', (c, n) =\u003e {\n\n\t\t// Set a cookie \n\t\tc.request.cookie.set({\n\t\t\tkey: 'my_id',\n\t\t\tvalue: '12345678',\n\t\t\tpath: '/',\n\t\t\tmaxAge: 100,\n\t\t\thttpOnly: true,\n\t\t\tsecure: false\n\t\t})\n\n\t\tc.body = 'Cookie Set'\n\t})\n\n\t_.get('/get', (c, n) =\u003e {\n\t\tc.body = c.request.cookies\n\t})\n}))\n\napp.listen(port)\n```\n\n## Documentation\n\n##### ~ `cookies` Array\nThe Cookie Parser sets an array `ctx.request.cookies` with the cookies that where sent with the request.\n###### Example\nLet's say we get a cookie (`Foo=Bar;`) We can access it in the context of Koa like this: `ctx.request.cookies['Foo']` =\u003e `\"bar\"`\n\n##### ~ `cookie` Element\nThe Parser also defines a getter and setter for cookies\n\n###### Example\n```javascript\n// Set a cookie\nctx.request.cookie.set({\n\tkey: 'my_id',\n\tvalue: '12345678',\n\tpath: '/',\n\tmaxAge: 100,\n\thttpOnly: true,\n\tsecure: false\n})\n```\n\n|Options | Value                          |\n|--------| -------------------------------|\n|Key     | Cookie Name                    |\n|Value   | Cookie Value                   |\n|Path    | Url Path                       |\n|Domain  | Sub or Domain                  |\n|httpOnly| bool                           |\n|secure  | bool                           |\n|max-age | seconds after the cookie expres|\n\n```javascript\n// Get a cookie\nctx.request.cookie.get('my_id') =\u003e \"12345678\"\n```\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcupcakearmy%2Fkoa-cookie","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcupcakearmy%2Fkoa-cookie","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcupcakearmy%2Fkoa-cookie/lists"}