@flitz/cookies
v1.0.4
Published
flitz middleware for parsing cookies.
Downloads
19
Maintainers
Readme
@flitz/cookies
A cookie middleware for flitz.
Install
Run
npm install --save @flitz/cookies
from the folder, where your package.json
is stored.
Usage
const flitz = require('flitz');
const cookies = require('@flitz/cookies');
const run = async () => {
const app = flitz();
app.get('/', [ cookies() ], async (req, res) => {
res.write( JSON.stringify(req.cookies) );
res.end();
});
await app.listen(3000);
};
run();
Or the TypeScript way:
import flitz from 'flitz';
import { cookies } from '@flitz/cookies';
const run = async () => {
const app = flitz();
app.get('/', [ cookies() ], async (req, res) => {
res.write( JSON.stringify(req.cookies) );
res.end();
});
await app.listen(3000);
};
run();
TypeScript
TypeScript is optionally supported. The module contains its own definition files.
License
MIT © Marcel Kloubert