Koa
路由
使用 koa 官方出品的中间件 koa-router。
文档:https://github.com/koajs/router
允许跨域
ctx.set('Access-Control-Allow-Origin', '*')
ctx.set('Access-Control-Allow-Headers', 'Content-Type');
ctx.set('Access-Control-Allow-Method', 'GET, POST')
注:对于单纯的 GET 请求,第2-3行非必要。