koajs / help

koa(1) executable for instant help
2 stars 3 forks source link

modularizing koa apps #2

Open jonathanong opened 10 years ago

jonathanong commented 10 years ago

migrated from https://github.com/koajs/koa/issues/210

I am trying to create a MVC framework based on koa. I need to know whether mounting several koa as middleware will affect negatively. I am currently using the technique described by @visionmedia in this video http://vimeo.com/56166857 . But it was express. I have seen koa-mount . I just want to know If this is the recommended way or something lighter is possible.

since mounted apps do not use their own settings and such (unlike express), there's not much point in actually mounting apps. instead, you could use middleware stacks directly with https://github.com/koajs/compose.

composing middleware will not significantly reduce performance - generators are fast, especially if you use delegating yields (whole different topic).

bhanuc commented 10 years ago

Thanks :+1:

cultofmetatron commented 10 years ago

this library I made might be useful for you if you need to compose generators.