Skip to content

Latest commit

 

History

History

universal-cookie-koa

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

universal-cookie-koa

Hook cookies get/set on Koa for server-rendering

Integrations

State management integration

Getting started

npm install universal-cookie-koa --save

Usage

cookiesMiddleware() koa middleware set req.universalCookies

Example

const Koa = require('koa');
const cookiesMiddleware = require('universal-cookie-koa');

const app = new Koa();

app.use(cookiesMiddleware()).use(function (ctx) {
  // get the user cookies using universal-cookie
  ctx.request.universalCookies.get('myCat');
});