Useful notes

Some other important concepts to be conscious of when building APIs with Koa include the following:

  • Cross-origin resource sharing (CORS): Koa-cors is a great middleware that helps to enable CORS on Koa-built APIs. This ensures that you are able to connect to your API from other origins.
  • Environment variables: You can environment variables, such as the port that you want the application to run in, database credentials, and so on, in a separate file, and load them into your variables by using the popular dotenv JavaScript module (https://www.npmjs.com/package/dotenv).
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.230.82