From the course: Learning Koa

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Listen and use syntax

Listen and use syntax

From the course: Learning Koa

Start my 1-month free trial

Listen and use syntax

- [Instructor] As you can see we've already done some of the listen and use syntax in our previous video. But if you have any experience with Node Express servers, you know this is fairly simple syntax. The app is the main object holding all the methods Koa offers, such as listen, and use. And one really cool areas of Koa is you can spin up multiple servers if you'd like, not just one. So you could run an https server on one port, and one on another port. So for example, in this code here we're seeing the http server running on port 3000, and then the https server running on port 3001. So use, like Express, is the main syntax we'll use to add any functions, or do anything with their server. And you'll see it repeated multiple times as we explore other areas of Koa. So when you want to create anything or any functions the server may do, you'll start with the app.use like so, and then the function. So for example, in this particular syntax, we are creating the app, we are adding the use…

Contents