This Lesson is for PRO Members.

Subscribe today and get access to all lessons! Plus direct HD download
for offline use, member comment forums, and iTunes "podcast" RSS feed.
Level up your skills now!

UNLOCK THIS LESSON

Already subscribed? Sign In

HIDE PLAYLIST

30% off

1 Year Pro Membership

Create a modern web API using Koa v2 and ES2017


We take advantage of the new Node.js features like async/await from ES2017 and the awesome yarn package-manager to create modern JSON APIs with Koa v2. Make sure you have at least Node.js 7.6.x installed.

The ctx (context) variable encapsulates a Request and Response object, they are similar to what we already know about the req and res objects from the Express.js framework, but it is more expressive and easy to understand thanks to its _getters, setters and some shortcuts. It also parses the response content and sets the Content-Type header based on the type of its body property. Finally, we can manually set the response headers and status code.

The HTTP client from the video is wuzz.

Please take a moment to tell your friends:

You must be a PRO Member to view code