Composer

Introduction


The composer is a component that is used to generate services and daemons on top of SOAJS.

By design, SOAJS does not concentrate on the data model nor the business logic of the service or daemon you are trying to build.

SOAJS focuses on providing you with the remaining components, layers and functionality that you actually need to build these services or daemons.

ex: multitenancy - registry - versioning - security - input cleaning and validation - standardized response generation ...

Based on that, SOAJS only requires you provided it with 2 static files so it can launch the service/daemon for you: configuration file - REST layer / Daemon Job List

Because these 2 files are static, every time you need to modify a service/daemon you need to edit them and push the changes.

Here is where the composer kicks in; the composer takes away the pain of writing/rewriting index.js for both services and daemons.


Features


By using the SOAJS composer, the developer only needs to write the config.js and shift his full focus on what the data model and business logic should contain.

The composer automatically generates:

FeatureDescription
REST Layer/Daemon Jobs ListBridge between config.js, data models, and business logic (index.js)
Database ConnectivityInitializes all databases connectivity In memory and provides a mechanism to inject them at run-time via models
Model InjectionInitializes all models In memory and provides a mechanism to inject them at run-time
Standardized Responsesnew method on top of the default SOAJS buildResponse that triggers closing all database connections (where keepAlive equal false) before formulating a response and closing the request or terminating a daemon job
Initialization and StartInitializes a service/daemon and starts it automatically
Middleware OrchestrationForces the developer to write the middleware(s) for Each API or daemon Job in a file (better and clearer files and code management)


All the user needs to do now is write the config.js, model functionality, and business logic of APIs/Jobs in middlewares for either services or daemons and the composer takes care of everything else!


Search this documentation

Recent updates