Nakul Manchanda c353f834a2 fix copyright, modified readme
Signed-off-by: Nakul Manchanda <nakul.manchanda@ibm.com>
2020-02-06 18:14:07 -05:00
2020-02-06 18:14:07 -05:00
2020-02-06 18:14:07 -05:00
2019-04-07 18:10:21 -05:00
2019-04-10 12:10:28 -05:00
2019-02-18 15:11:44 +00:00
2020-02-06 00:07:33 -05:00
2020-02-06 18:14:07 -05:00

sample-node-api

A sample node js api for finding cars and accounts for a dealership,its used here to demonstrate the steps to extend API/ML with your own rest api.

Steps

Note
Only rest api with https support can be deployed behind API/ML, make sure to enable https support in your rest api.
This sample express app, has https enabled already.

1) Clone the repository, install node packages and verify routes locally

//on local
git clone https://github.com/zowe/sample-node-api
cd sample-node-api
npm install
npm start

Open your local browser and try accessing
https://localhost:4000/accounts/
https://localhost:4000/accounts/1
https://localhost:4000/accounts/1/cars/

2) Transfer project files from local to remote host

Note
Don't transfer node_modules folder, we can do install npm install later on remote server itself to pull down required node packages

scp -r sample-node-api ibmuser@my.mainframe.com:</usr/lpp/extender>/sample-node-api

3) Register as External Component

Append to EXTERNAL_COMPONENT </usr/lpp/extender>/sample-node-api/bin in INSTANCE_DIR/instance.env

 vi INSTANCE_DIR/instance.env
 EXTERNAL_COMPONENTS=</usr/lpp/extender>/sample-node-api/bin

It expects folder with start.sh, configure.sh and validate.sh, provides lifecycle hooks to configure and start your api component with rest of zowe. In our case its bin folder with relevant scripts.

4) Access newly deployed webservice behind api/v1

https://my.mainframe.com:7554/api/v1/sample-node-api/accounts/
https://my.mainframe.com:7554/api/v1/sample-node-api/accounts/1/
https://my.mainframe.com:7554/api/v1/sample-node-api/accounts/1/cars/

Description
No description provided
Readme EPL-2.0 924 KiB
Languages
JavaScript 62.4%
Shell 32.7%
Dockerfile 4.9%