component building middleware for koa