We will not go into much detail on this, as it was covered in the previous chapter. To start our server, we will simply insert the following content into the index.js entry file:
// ./index.js
const Koa = require('koa');
const app = new Koa();
const port = process.env.PORT || 3000;
app.listen(port, () => console.log(`Server running on http://localhost:${port}`));
The server either runs on a specified port with the PORT environmental variable or on the default 3000 port.
To start our application, you can run this command from the project root:
node index.js
You can also use nodemon to start the app for automatic reloads anytime a change is made to a file in the project folder, nodemon index.js