As we can call multiple handler from router get request, how do we pass, say the result computed in the first handler to the next handler block ?
// Uses multiple handler blocks
router.get("/multi", handler: { request, response, next in
response.send("I'm here!\n")
next()
}, { request, response, next in
response.send("Me too!\n")
next()
})
You can use the
userInfo
dictionary to hold computed data in therequest
object, and it'll be accessible in the subsequent handlers.https://ibm-swift.github.io/Kitura/Classes/RouterRequest.html#/s:vC6Kitura13RouterRequest8userInfoGVs10DictionarySSP__