I have a three koa application and the structure of this these application is like this :
app.js
directory app2
directory app3
i try to mount app2.js and app3.js on app.js using koa-mount
package but i get an error :
var name = app.name || 'unnamed';
^
TypeError: Cannot read property 'name' of undefined
so the question is how to load different koa application as middleware that exists in different directory?
Solution
according to this github issue app2.js and app3.js should be a module so use module.exports and the in app.js require them as a variable and then mount the variable on specific route variable and then mount the variable on specific route