Skip to content

Commit

Permalink
feat: add a Router() method that returns a mountable mini-app Router …
Browse files Browse the repository at this point in the history
…when called.

It takes an optional boolean parameter that specifies if the router should inherit middlewares from
the main app when it gets mounted. It defaults to true
  • Loading branch information
teclone committed Jul 26, 2018
1 parent 216385b commit 7fce028
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/main.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,22 @@
import RServerApp from './modules/RServerApp.js';
import Router from './modules/Router.js';

export default {

/**
* returns an app instance
*/
instance(configPath) {
return new RServerApp(configPath);
},

/**
* creates mountable router
*@param {boolean} [inheritMiddlewares=true] - boolean value indicating if parent middlewares should
* be inherited. defaults to true
*@returns {Router}
*/
Router(inheritMiddlewares) {
return new Router(inheritMiddlewares);
}
};

0 comments on commit 7fce028

Please sign in to comment.