@modular-rest/server 1.3.3 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@modular-rest/server",
3
- "version": "1.3.3",
3
+ "version": "1.4.0",
4
4
  "description": "a nodejs module based on KOAJS for developing Rest-APIs in a modular solution.",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -12,8 +12,8 @@ let defaultServiceRoot = __dirname + '/services';
12
12
  /**
13
13
  * @param {{
14
14
  * cors: any; // Options for @koa/cors middleware.
15
- * componentDirectory: string; // Root directory of your router.js/db.js files.
16
- * uploadDirectory: string; // Root directory for uploaded files.
15
+ * modulesPath: string; // Root directory of your router.js/db.js files.
16
+ * staticPath: string; // Root directory for uploaded files.
17
17
  * onBeforeInit: (koaApp) => void; // A callback called before initializing the Koa server.
18
18
  * onAfterInit: (koaApp) => void; // A callback called after server initialization.
19
19
  * port: number; // Server port.
@@ -71,9 +71,9 @@ module.exports = async function createRest(options) {
71
71
  /**
72
72
  * Plug In KoaStatic
73
73
  */
74
- if (options.uploadDirectory)
74
+ if (options.staticPath)
75
75
  app.use(koaStatic({
76
- rootDir: options.uploadDirectory,
76
+ rootDir: options.staticPath,
77
77
  rootPath: '/assets/',
78
78
 
79
79
  }));
@@ -118,15 +118,15 @@ module.exports = async function createRest(options) {
118
118
  *
119
119
  * Plug in routes and database
120
120
  */
121
- if (options.componentDirectory) {
121
+ if (options.modulesPath) {
122
122
 
123
123
  // Plug in user routes
124
- await Combination.combineRoutesByFilePath(options.componentDirectory, app);
124
+ await Combination.combineRoutesByFilePath(options.modulesPath, app);
125
125
 
126
126
  // Collect user CollectionDefinitions (db.js files)
127
127
  let userDatabaseDetail = [];
128
128
  userDatabaseDetail = await Combination.combineModulesByFilePath({
129
- rootDirectory: options.componentDirectory,
129
+ rootDirectory: options.modulesPath,
130
130
  filename: {
131
131
  name: 'db',
132
132
  extension: '.js'