From 95aef63e1f9a947fd438585fb331c9bb97a2b369 Mon Sep 17 00:00:00 2001 From: Jon Church Date: Sat, 18 Apr 2020 22:01:42 -0400 Subject: [PATCH] update README with router.params promise info --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index a498379..ddcdb81 100644 --- a/README.md +++ b/README.md @@ -115,6 +115,10 @@ Maps the specified path parameter `name` to a specialized param-capturing middle This function positions the middleware in the same stack as `.use`. +If a `Promise` object is returned from the `param_middleware` function, the router +will attach an `onRejected` callback using `.then`. If the promise is rejected, +`next` will be called with the rejected value, or an error if the value is falsy. + Parameter mapping is used to provide pre-conditions to routes which use normalized placeholders. For example a _:user_id_ parameter could automatically load a user's information from the database without