Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

koa-cookies

Package Overview
Dependencies
Maintainers
1
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

koa-cookies

Set and clear cookies in your Koa application

  • 3.1.4
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
6.9K
decreased by-25.82%
Maintainers
1
Weekly downloads
 
Created
Source

koa-cookies

Set and clear cookies in your Koa application.

Donate


Installation

npm i koa-cookies

Usage

// set up your koa server, koa-router, etc.
const { clearCookie, setCookie } = require('koa-cookies')

app.get('/foo', async (ctx, next) => {
  setCookie('bar', 'baz')(ctx)
  // other /foo stuff
})

app.get('/things', (ctx) => {
  clearCookie('foo')(ctx)
})

app.use(setCookie('foo', 'bar', config))
app.use(clearCookie('baz', config))

setCookie and clearCookie work in both routes and as middleware.

The config argument is optional. Defaults:

setCookieConfig = {
  domain: ctx.host,
  maxAge: one week,
  expires: one week from now
}

clearCookieConfig = {
  domain: ctx.host,
  maxAge: 1 second,
  expires: 1970-01-01T00:00:00.001Z
}

LICENSE

Keywords

FAQs

Package last updated on 10 May 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc