November 2018
Beginner
132 pages
2h 57m
English
The context object exposes various methods and properties to help with HTTP application development and middleware creation. In this way, Koa varies from its predecessor, Express, in that the many functions needed for development can be accessed simply via the context object instead of needing to access the request (req) and response (res) objects separately.
Some of the methods and properties exposed on the Context object include the following:
For example, you can access an object containing the request headers by using the req.headers property, as seen here:
console.log(ctx.req.headers);// => { host: ...Read now
Unlock full access