Content Builder

Objective


When creating a microservice, a developer needs to cater for:

  • create config.js containing service information and API configuration
  • create model.js containing function that handle calls to the databases to be supported. A separate model.js file is required for every supported database.
  • create BLModule.js containing the business logic that will implement the service features.
  • create index.js bridging the above files together.


Now let's see how things look like when we invoke the use of the GCS.

To access the UI of the GCS start by making sure the GCS service is running and logging into the SOAJS dashboard and selecting the "Develop" pillar, then "Content Builder" in the left-hand side menu.

Quick Reminder

Remember that you need to have started the controller, urac, and dashbaord services all in the dashbaord environment (set SOAJS_ENV=dashboard as an environment variable before starting the required services) to be able to access the dashboard!

This screen allows the user to name their service and select which database to use.



The cluster to be used must be previously created.

After this information is specified, this next screen appears:




Clicking on "Add New Input":



Here, wre can choose how many inputs our APIs should have along with their properties.

On the next screen, we will we fill out the schema of our service by specifying different parameters we want our service to use.




Finally, we can add our service's APIs:


Here we specify which API method and type, along with the default error code (that was previously configured) among other API information.

Once completed, this screen will be visible:



Now just click "Generate Service Schema" and that's it!

Now turn on the service you just created:

# go to soajs.gcs directory
cd /opt/soajs/node_modules/soajs.gcs


# export necessary environment variables
export SOAJS_GC_NAME=[enter generic content name here]
export SOAJS_GC_VERSION=[enter generic content version here]

# Start gcs
cd soajs.gcs
node .


You now have a running service generated by the GCS!