provided when
import {parseCookie} from 'u-http-server';
app.use(app.parseCookie);
app.get('/', ({cookies}) => cookies);
When you call it :
HTTP GET /
{}
// a json object with cookies info
params from url
if init({protocol: 'http2'})
then Http2ServerRequest
else IncomingMessage
if init({protocol: 'http2'})
then Http2ServerResponse
else ServerResponse
provided when
import {sessionInMemory} from 'u-http-server';
app.use(app.sessionInMemory);
app.use(ctx => ctx.session.lastVisitedUrl = app.address + ctx.request.url)
app.get('/session-info', ({session}) => session);
When you call it :
HTTP GET /
{"lastVisitedUrl": "http://localhost:3000/session-info"}
Generated using TypeDoc
Provided by custom middlewares
All middlewares (and routes) can edit the context, be carefull to not clash with other middlewares 😉