npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@zowe/apiml-onboarding-enabler-nodejs

v3.0.49

Published

NodeJS enabler for Zowe API Mediation Layer

Downloads

806

Readme

Onboarding Node.js enabler for Zowe API Mediation Layer

This is the onboarding Node.js enabler for Zowe API Mediation Layer (part of Zowe) that allows to register a NodeJS based service to the API Mediation Layer Discovery Service. It uses eureka-js-client.

How to use

  1. Install the onboarding Node.js enabler package as a dependency of your service:

    npm i @zowe/apiml-onboarding-enabler-nodejs --dev-save

  2. Inside your Node.js service index.js, add the following code block to register your service with Eureka:

    const apiLayerService = require("@zowe/apiml-onboarding-enabler-nodejs");
    tlsOptions = apiLayerService.tlsOptions;
    const httpsServer = https.createServer(tlsOptions, app);
    httpsServer.listen(args.port, function () {
        apiLayerService.connectToEureka();
    });
       

    To make sure that your application will automatically unregister from Eureka once shut down, you can use the unregisterFromEureka() function, like shown in the example below. Example:

    process.on('SIGINT', signal => {
        apiLayerService.unregisterFromEureka();
        httpsServer.close(() => {
            process.exit(0);
        });
    });   
           
  3. Create a yaml file named service-configuration.yml, add the configuration properties and place the yaml file inside a /config directory at the same level of your index.js. Below is an example of the configuration.

    Example:

    serviceId: hwexpress
    title: Hello World express REST API
    eureka:
      ssl: true
      host: localhost
      ipAddress: 127.0.0.1
      port: 10011
      servicePath: '/eureka/apps/'
      maxRetries: 30
      requestRetryDelay: 1000
      registryFetchInterval: 5
       
       
    description: Hello World REST API Service implemented in Express and Node.js
    baseUrl: https://localhost:10020/hwexpress
    homePageRelativeUrl: https://localhost:10020/
    statusPageRelativeUrl: https://localhost:10020/info
    healthCheckRelativeUrl: https://localhost:10020/status
    discoveryServiceUrls:
      - https://localhost:10011/eureka
    routes:
      - gatewayUrl: /api/v1
        serviceRelativeUrl: /api/v1
    apiInfo:
      - apiId: org.zowe.hwexpress
        gatewayUrl: "api/v1"
        swaggerUrl: https://localhost:10020/swagger.json
    catalogUiTile:
      id: cademoapps
      title: Sample API Mediation Layer Applications
      description: Applications which demonstrate how to make a service integrated to the API Mediation Layer ecosystem
      version: 1.0.0
    instance:
      app: hwexpress
      vipAddress: hwexpress
      instanceId: localhost:hwexpress:10020
      homePageUrl: https://localhost:10020/
      hostName: 'localhost'
      ipAddr: '127.0.0.1'
      secureVipAddress: hwexpress
      port:
        $: 10020
        '@enabled': false
      securePort:
        $: 10020
        '@enabled': "true"
       
      dataCenterInfo:
        '@class': com.netflix.appinfo.InstanceInfo$DefaultDataCenterInfo
        name: MyOwn
      metadata:
        apiml.catalog.tile.id: 'samplenodeservice'
        apiml.catalog.tile.title: 'Zowe Sample Node Service'
        apiml.catalog.tile.description: 'NodeJS Sample service running'
        apiml.catalog.tile.version: '1.0.0'
        apiml.routes.api_v1.gatewayUrl: "api/v1"
        apiml.routes.api_v1.serviceUrl: "/api/v1"
        apiml.apiInfo.0.apiId: org.zowe.hwexpress
        apiml.apiInfo.0.gatewayUrl: "api/v1"
        apiml.apiInfo.0.swaggerUrl: https://localhost:10020/swagger.json
        apiml.service.title: 'Zowe Sample Node Service'
        apiml.service.description: 'The Proxy Server is an HTTP HTTPS, and Websocket server built upon NodeJS and ExpressJS.'
       
    ssl:
      certificate: ssl/localhost.keystore.cer
      keystore: ssl/localhost.keystore.key
      caFile: ssl/localhost.pem
      keyPassword: password
       
  4. Start your Node.js service and verify that it registers to the Zowe API Mediation Layer.