@modular-rest/server 1.3.2 → 1.3.3
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 +1 -1
- package/src/application.js +26 -23
package/package.json
CHANGED
package/src/application.js
CHANGED
|
@@ -10,27 +10,30 @@ let UserService = require('./services/user_manager/service')
|
|
|
10
10
|
let defaultServiceRoot = __dirname + '/services';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
|
-
* @param {
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
13
|
+
* @param {{
|
|
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.
|
|
17
|
+
* onBeforeInit: (koaApp) => void; // A callback called before initializing the Koa server.
|
|
18
|
+
* onAfterInit: (koaApp) => void; // A callback called after server initialization.
|
|
19
|
+
* port: number; // Server port.
|
|
20
|
+
* dontListen: boolean; // If true, the server will not run and will only return the Koa app object.
|
|
21
|
+
* mongo: {
|
|
22
|
+
* dbPrefix: string; // A prefix for your database name.
|
|
23
|
+
* mongoBaseAddress: string; // The address of your MongoDB server without any database specification.
|
|
24
|
+
* addressMap: string; // Specific addresses for each database.
|
|
25
|
+
* };
|
|
26
|
+
* keypair: {
|
|
27
|
+
* private: string; // Private key for RSA authentication.
|
|
28
|
+
* public: string; // Public key for RSA authentication.
|
|
29
|
+
* };
|
|
30
|
+
* adminUser: {
|
|
31
|
+
* email: string; // Admin user email.
|
|
32
|
+
* password: string; // Admin user password.
|
|
33
|
+
* };
|
|
34
|
+
* verificationCodeGeneratorMethod: () => string; // A method to return a verification code when registering a new user.
|
|
35
|
+
* collectionDefinitions: CollectionDefinition[]; // An array of additional collection definitions.
|
|
36
|
+
* }} options
|
|
34
37
|
*/
|
|
35
38
|
module.exports = async function createRest(options) {
|
|
36
39
|
|
|
@@ -132,8 +135,8 @@ module.exports = async function createRest(options) {
|
|
|
132
135
|
});
|
|
133
136
|
|
|
134
137
|
// combine additional CollectionDefinitions
|
|
135
|
-
if (options.
|
|
136
|
-
userDatabaseDetail.concat(options.
|
|
138
|
+
if (options.collectionDefinitions) {
|
|
139
|
+
userDatabaseDetail.concat(options.collectionDefinitions)
|
|
137
140
|
}
|
|
138
141
|
|
|
139
142
|
// Plug in user CollectionDefinitions
|