SuperAPI AI Directory

koa

Coding & development

View repository

Updated 10-15 21:48

About this skill

When to use this skill

Use this skill whenever the user wants to:

  • Writing Node.js HTTP services, middleware and the onion model with Koa
  • Configure routing (koa-router), body parsing, error handling and deployment

How to use this skill

  1. Core: Koa(), ctx and next; async middleware and onion order; ctx.body, ctx.status.
  2. Ecosystem: koa-router, koa-bodyparser, koa-static; error and logging middleware.
  3. Reference:https://koajs.com/

Best Practices

  • Correct use of middleware async and next; unified error catching.
  • Use a reverse proxy and HTTPS in production; security and CORS.

Keywords

koa, Node.js, middleware, onion model