universal-cookie-koa
v7.2.2
Published
Hook cookies get/set on Koa for server-rendering
Downloads
84,392
Readme
Integrations
State management integration
universal-cookie
- Universal cookies for JavaScriptreact-cookie
- Universal cookies for React
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');
});