Join Alexander Zanfir for an in-depth discussion in this video Creating an endpoint with Koa, part of Up and Running with Node.js.
Next, let's create the exercise file.…We'll call it Koa endpoint demo.js…and next we'll create the Koa variable and require in Koa.…And as we did with Express, we'll create an app variable…and reference the Koa instance.…And now to make a very simple endpoint,…we'll use app.use as we did with Express but this time,…we'll be using a generator function.…
And you can tell that it's a generator function…because the syntax is a bit different.…It has an asterisk in its' definition.…And unlike Express, the request and response objects…are not passed in as parameters.…
- Installing Node.js
- Writing modules and packages
- Reading and writing files
- Working with frameworks: Express, Sails, and Koa
- Generating promises
- Working with generator functions
Skill Level Beginner
Q: When I try to install Bluebird/Express/Gulp/Sails/KOA using the Node Package Manager, it seems to install correctly in the terminal. But why doesn't my project folder change?
A: You need to make sure that you've navigated to your project folder in the terminal. For example, in this course Alexander is working from the C:\Dev\ folder both in Brackets and in the terminal.