Security News
The Risks of Misguided Research in Supply Chain Security
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
@skazka/server-cookies
Advanced tools
Parse Cookie header and populate ctx.request.cookies with an object keyed by the cookie names.
npm i @skazka/server @skazka/server-cookies @skazka/server-request
With yarn:
yarn add @skazka/server @skazka/server-cookies @skazka/server-request
Optionally you can add http server, error handler, logger, router and response:
npm i @skazka/server-http @skazka/server-router @skazka/server-error @skazka/server-logger @skazka/server-response
With yarn:
yarn add @skazka/server-http @skazka/server-router @skazka/server-error @skazka/server-logger @skazka/server-response
const App = require('@skazka/server');
const Router = require('@skazka/server-router');
const cookies = require('@skazka/server-cookies');
const error = require('@skazka/server-error');
const logger = require('@skazka/server-logger');
const request = require('@skazka/server-request');
const response = require('@skazka/server-response');
const server = require('@skazka/server-http');
const app = new App();
const router = new Router();
app.all([
error(),
logger(),
request(),
cookies(),
response(),
]);
app.then(async (ctx) => {
// it works for each request
console.log(ctx.request.cookies);
});
router.get('/data').then(async (ctx) => {
return ctx.response('data');
});
app.then(router.resolve());
server.createHttpServer(app);
Or you can get cookies for one route:
const App = require('@skazka/server');
const Router = require('@skazka/server-router');
const cookies = require('@skazka/server-cookies');
const error = require('@skazka/server-error');
const logger = require('@skazka/server-logger');
const request = require('@skazka/server-request');
const response = require('@skazka/server-response');
const server = require('@skazka/server-http');
const app = new App();
const router = new Router();
app.all([
error(),
logger(),
request(),
response(),
]);
router.get('/data').then(async (ctx) => {
const cookiesObject = await cookies(ctx);
return ctx.response(cookiesObject);
});
app.then(router.resolve());
server.createHttpServer(app);
FAQs
Server cookies parser
We found that @skazka/server-cookies demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
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.
Security News
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.