Closed arteymix closed 8 years ago
The context provide a hierarchical mapping of states shared among handlers. It is possible to access the parent context.
var context = new Context (); var context_with_parent = new Context.with_parent (context);
All operations are recursively applied. If a key is missing in the current context, it is retrieved in its parent.
app.use ((req, res, next, context) => { context["id"] = "6"; next (req, res); }); app.get ("user/<int:id>", (req, res, next, context) => { var user_id = context["id"].get_string (); context.parent["id"]; // refers to '6' });
It completely replace Request.params, which has been removed.
Request.params
The context provide a hierarchical mapping of states shared among handlers. It is possible to access the parent context.
All operations are recursively applied. If a key is missing in the current context, it is retrieved in its parent.
It completely replace
Request.params
, which has been removed.