Onboarding a Node.js based REST API service
This article is part of a series of onboarding articles, which outline the process of onboarding REST API services to the Zowe API Mediation Layer (API ML). As a service developer, you can onboard a REST service based on NodeJS with the API ML with the Zowe API Mediation Layer using our Node.js Enabler.
Note: For more information about onboarding API services with the API ML, see the Onboarding Overview.
#
IntroductionThe API ML onboarding Node.js enabler is an NPM package which helps to simplify the process of onboarding a REST service written in Node.js with the API ML.
For more information about how to utilize another API ML enablers, see the Onboarding Overview.
#
Onboarding your Node.js service with API MLThe following steps outline the overall process to onboard a REST service with the API ML using the onboarding Node.js enabler. Each step is described in further detail in this article.
#
PrerequisitesEnsure that you meet the following prerequisites:
- You satisfy the prerequisites from the Onboarding Overview.
- The REST API service to onboard is written in Node.js.
- The service is enabled to communicate with API ML Discovery Service over a TLS v1.2 secured connection.
#
Installing the npm dependencyInstall the onboarding Node.js enabler package as a dependency of your service. Run the following npm command from your project directory:
Note: If you have a multi-module project, you have to run the npm command from the submodule where your Node.js project is located.
#
Configuring your serviceCreate a yaml file named service-configuration.yml
inside a /config
directory at the same level of your index.js
, and add the following configuration properties.
The following example shows a sample configuration.
Example:
#
Registering your service with API MLTo register your service with API ML, use the following procedure.
Follow these steps:
Inside your Node.js service
index.js
, add the following code block to register your service with Eureka:Start your Node.js service and verify that the service is registered to the Zowe API Mediation Layer.
#
Validating the discoverability of your API service by the Discovery ServiceOnce you build and start your service successfully, you can use the option of validating that your service is registered correctly with the API ML Discovery Service.
Follow these steps:
Check that you can access your API service endpoints through the Gateway.
(Optional) Check that you can access your API service endpoints directly outside of the Gateway.
Specific addresses and user credentials for the individual API ML components depend on your target runtime environment.
Note: If you are working with a local installation of API ML, and you are using our dummy identity provider, enter user
for both username
and password
. If API ML was installed by system administrators, ask them to provide you
with actual addresses of API ML components and the respective user credentials.
Note: Wait for the Discovery Service to fully register your service. This process may take a few minutes after your service starts successfully.