{"id":25257279,"url":"https://github.com/zowe/sample-node-api","last_synced_at":"2025-10-27T02:31:47.562Z","repository":{"id":41447048,"uuid":"171305233","full_name":"zowe/sample-node-api","owner":"zowe","description":"A sample node js api for finding cars and accounts for a dealership","archived":false,"fork":false,"pushed_at":"2023-03-04T03:09:41.000Z","size":901,"stargazers_count":80,"open_issues_count":11,"forks_count":146,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-03-22T02:01:04.686Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"epl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zowe.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-02-18T15:08:16.000Z","updated_at":"2024-02-06T13:35:46.000Z","dependencies_parsed_at":"2023-01-26T09:31:31.030Z","dependency_job_id":null,"html_url":"https://github.com/zowe/sample-node-api","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zowe%2Fsample-node-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zowe%2Fsample-node-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zowe%2Fsample-node-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zowe%2Fsample-node-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zowe","download_url":"https://codeload.github.com/zowe/sample-node-api/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238424100,"owners_count":19469982,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-02-12T06:38:43.581Z","updated_at":"2025-10-27T02:31:47.176Z","avatar_url":"https://github.com/zowe.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# sample-node-api  \nA 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.     \n\n## Steps\n\n**Note**  \n`Only rest api with https support can be deployed behind API/ML, make sure to enable https support in your rest api.\n`   \nThis sample express app, has https enabled already.    \n\n## PART I: Download \u0026 Build on local\n\n## Method 1: From github\n### 1) Clone the repository, install node packages  and verify routes locally\n\n``` \n//on local\ngit clone https://github.com/zowe/sample-node-api\ncd sample-node-api\nnpm install\nnpm start\n```\n\nOpen your local browser and verify the sample-node-api is working by accessing:     \n`http://localhost:18000/accounts/`   \n`http://localhost:18000/accounts/1`   \n`http://localhost:18000/accounts/1/cars/`   \n\n\n### 2) Transfer project files from local to remote host\n\n**Note**  \nThe `node_modules` folder will not be transferred, we can do npm install later on remote server itself to pull down required node packages\n\n```\ncd sample-node-api\nnpm run build\nscp -r dist ibmuser@my.mainframe.com:\u003c/usr/lpp/extender\u003e/sample-node-api\n```\n\nFor the next step, ensure that you have node installed on z/OS and your PATH includes nodejs/bin directory.\n\n```\nssh ibmuser@my.mainframe.com\n. ~/.profile - (Skip if you can already run \"npm\" on z/OS)\ncd \u003c/usr/lpp/extender\u003e/sample-node-api\nnpm install\n```\n\n## Method 2: From Artifactory\n### 1) Download latest pax from artifactory\nGet latest package from [artifactory](https://zowe.jfrog.io/artifactory/libs-snapshot-local/org/zowe/sample-node-api/1.0.0-SNAPSHOT)\n\nChoose the latest pax build provided from the link above and download it into your local storage.\n\n### 2) Transfer and unpax on z/OS\n```\nsftp ibmuser@mymainframe.ibm.com\nput \u003cpax-name\u003e.pax\n```\n\n## PART II: Deploy with Zowe on server\n\n### 1) login\n```  \nssh ibmuser@my.mainframe.com       \n```\n\n### 2) install component using zowe-install-component.sh script\n```\n./\u003czowe-runtime-dir\u003e/bin/zowe-install-component.sh -d \u003czowe-extensions-dir\u003e -i \u003czowe-instance-dir\u003e -o \u003ccomponent-file-path\u003e -l \u003clog-folder\u003e\n```\n```\n\u003czowe-extensions-dir\u003e - Directory that will hold all external extensions installed onto zowe\n\u003czowe-instance-dir\u003e - Current installed Zowe's instance directory\n\u003ccomponent-file-path\u003e - The path to the component being installed (the component file transferred from local to z/OS in PART I)\n\u003clog-file\u003e - Directory that will hold the logs of the component installation\n```\n\n### 3) Lifecycle scripts of the component\n\nWe expect following in service folder `start.sh`. In our case its bin folder with relevant scripts.\n\n`start.sh` starts node app on configured port       \n`env.sh` its custom script use to configure port for our node app, feel free to use your desired way         \n\n### 4) Access newly deployed webservice\n\nPlease see static definition file `sample-node-api.yml`      \nIt configures service endpoint as `sample-node-api` with property `serviceId`     \nWe also provide api gateway base path `api\\v1` with property `gatewayUrl` in same file.        \n\n\nIn effect, service can be accessed with following url:      \n`https://{host}:{GATEWAY_PORT}/{gatewayUrl}/{serviceId}/*`    \n\nwhere `GATEWAY_PORT` is configured in $INSTANCE_DIR/instance.env      \n\nVerify by accessing following:      \n`https://my.mainframe.com:7554/api/v1/sample-node-api/accounts/`            \n`https://my.mainframe.com:7554/api/v1/sample-node-api/accounts/1/`            \n`https://my.mainframe.com:7554/api/v1/sample-node-api/accounts/1/cars/`              \n\n### 5) Registered With API Catalog\n\n**API Catalog**\n![APICatalog_Dashboard](./screenshots/APICatalog_Dashboard.png)\n\n![ApiCatalog_SampleNodeApi_SwaggerDoc](./screenshots/ApiCatalog_SampleNodeApi_SwaggerDoc.png)\n\n**Discovery Service Dashboard**\n![DiscoveryService_Dashboard](./screenshots/DiscoveryService_Dashboard.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzowe%2Fsample-node-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzowe%2Fsample-node-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzowe%2Fsample-node-api/lists"}