1.4.1 • Published 4 years ago
node-express-service-core v1.4.1
node-express-service-core
The library description and all othe specifications are in the TDD. This README file responds to that document.
Current version: 0.1
Settings
Name | Type | Required | Default | Description |
---|---|---|---|---|
rootPath | String | true | --- | Root directory for loading service settings or files |
api.prefix | String | false | 'api' | Route Service prefix |
api.version | String | false | 'v1' | Route Service Version |
logger | Boolean | false | false | On/Off service logger |
mongoString | String | false | --- | Mongo string path |
disableCors | Boolean | false | false | Allows to load white list for CORS origin management |
port | Number | false | 3000 | Service running port |
bodyParserLiit | String | false | '50mb' | Service forms data size limit |
Initialization
const Core = require('node-express-service-core');
const settings = {
rootPath: __dirname, // required
api: { // optional
prefix: 'servicename',
version: 'v1'
},
logger: true, // optional
mongoString: 'mongodb://localhost/MyDB', // optional
disableCors: true, // optional
port: 3000, // optional
bodyParserLimit: '50mb'
};
Core.init(settings).run();
Service Structure
+ app/
+--- Api.js
+--- OtherApi.js
+ config/
+--- routes.js
+--- whitelist.json
+ services/
+--- ServiceExample.js
+--- OtherServiceExample.js
+ models/
+--- ModelExample.js
+--- OtherModelExample.js
+ utils/
+--- Library.js
+--- Middleware.js
+--- Other.js
+ index.js