koa-cookie is a straightforward middleware for the Koa.js web framework, designed to parse HTTP `Cookie` headers and expose their contents as a convenient JavaScript object on `ctx.cookie`. Currently at version 1.0.0, this package provides a minimalist solution for accessing request cookies without additional features like cookie signing or complex serialization, adhering to a 'do one thing well' philosophy. Its release cadence is stable, with v1.0.0 being the primary and seemingly final release, indicating a maintenance-only status rather than active feature development. Key differentiators include its extreme simplicity and direct integration with Koa's context object, making it easy to drop into existing Koa applications, including those using `koa-router`. It's suitable for applications that handle cookie security (signing, encryption) at a different layer or don't require such features from the parser itself.
npm install koa-cookieVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to initialize `koa-cookie` middleware and access parsed cookies via `ctx.cookie` in a simple Koa application, along with an example of setting cookies (which `koa-cookie` does not handle directly).
Ensure `app.use(cookie());` is called at the top of your middleware stack, before router or business logic middleware.
Implement cookie signing/encryption separately (e.g., with `koa-session`, `koa-csrf`, or by manually using cryptographic libraries) or choose a more feature-rich session management library if these features are required.
For new projects or long-term stability, consider alternative, actively maintained cookie parsing or session management solutions for Koa. If using it, regularly test for compatibility and security issues.
Make sure `app.use(cookie());` is called once at the start of your application's middleware chain.
Verify that `app.use(cookie());` is one of the first middleware applied to your Koa application. Inspect incoming headers with a debugging tool to ensure the 'Cookie' header is present as expected.
No dependency data recorded yet.