Koahub-loader
Koahub-loader is a koahub.js Koahub-loader controller based on the KOA Platform node. JS Development, model, help method automatically load
Koahub Loader
Installation
$ NPM Install Koahub-loader Use with KOA
1.model Loader var model = Loader ([ { Root: './app/model ', Suffix: '. Model.js ' }, { Root: './addon ', Suffix: '. Model.js ', Filter: [/\w*\/model\//] } ]);
2.controller Loader var app = require (' KOA ') (); var router = require (' Koa-router ') (); var controller = loader ([ { Root: './app/controller ', Suffix: '. Controller.js ', Prefix: '/', }, { Root: './addon ', Suffix: '. Controller.js ', Prefix: '/addon/', Filter: [/\w*\/controller\//] } ]);
for (var key in Controller) { Router.use (Key, Controller[key].routes ()); } App.use (Router.routes ());
3.util Loader var util = Loader ([ { Root: './app/common ', Suffix: '. Util.js ' }, { Root: './addon ', Suffix: '. Util.js ', Filter: [/\w*\/common\//] } ]);
Official website: http://js.koahub.com
|
Based on KOA platform node. JS developed Koahub.js Controller, model, help method to automatically load