Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

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.

Note
titleQuick 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.

Image Added



The cluster to be used must be previously created.

After this information is specified, this next screen appears:

Image Added



Image Added


Clicking on "Add New Input":


Image Added


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.


Image Added



Finally, we can add our service's APIs:

Image Added

Image Added


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:


Image Added


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

Now turn on the service you just created:

Code Block
languagebash
# 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!