1.4.1 • Published 4 years ago

node-express-service-core v1.4.1

Weekly downloads
3
License
MIT
Repository
gitlab
Last release
4 years ago

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

Back to top

NameTypeRequiredDefaultDescription
rootPathString true--- Root directory for loading service settings or files
api.prefixStringfalse'api'Route Service prefix
 api.version Stringfalse 'v1' Route Service Version
loggerBooleanfalsefalseOn/Off service logger
mongoStringStringfalse---Mongo string path
disableCorsBooleanfalsefalseAllows to load white list for CORS origin management
portNumberfalse3000Service running port
bodyParserLiitStringfalse'50mb'Service forms data size limit

Initialization

Back to top

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

Back to top

+ 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