micro-cookie

1.2.0 • Public • Published

micro-cookie

cookie parser for zeit's micro

Parses request cookies and puts the object in req.cookies

Installation

yarn add micro-cookie

Usage

const parseCookies = require('micro-cookie')
 
module.exports = parseCookies(async function(req, res) {
  return 'Hello World!'
})

With other micro plugins

const visualize = require('micro-visualize')
const cors = require('micro-cors')
const cookieParse = require('micro-cookie')
const { send } = require('micro')
 
module.exports = visualize(cors(cookieParse(async function(req, res) {
  const responseMessage = {
    message: 'hello world!',
    cookies: req.cookies
  }
  send(res, 200, responseMessage)
})))

/micro-cookie/

    Package Sidebar

    Install

    npm i micro-cookie

    Weekly Downloads

    198

    Version

    1.2.0

    License

    MIT

    Unpacked Size

    5.62 kB

    Total Files

    5

    Last publish

    Collaborators

    • zakjholt