Egghead Instructor Patricio López

Patricio López

Enthusiastic software engineer from Santiago, Chile.
Loves teaching as he loves music.



Support Patricio's Free Lessons
become a member today

Browse Patricio López's lessons.

showing 2 lessons...

Setup Nodemon to automatically restart the server

Create a modern web API using Koa v2 and ES2017

node tutorial about Setup Nodemon to automatically restart the server

Setup Nodemon to automatically restart the server

1:02 node

Soon or later, we get tired of having to manually restart our Node.js application. We will install and configure Nodemon to help us with that headache.

Remember to install it as a development dependency with yarn add --dev nodemon and limit its scope with --watch [dir].

node tutorial about Create a modern web API using Koa v2 and ES2017

Create a modern web API using Koa v2 and ES2017

1:25 node

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.

HEY, QUICK QUESTION!
Joel's Head
Why are we asking?