node package manager

dd-cognitive-service-module-ui

dd-cognitive-service-module

How to run it

npm start

Run the service module locally

npm run start:doc

Run the service module locally and host the api doc

npm run start:watch

Run the service module locally and watch local file change to reload automatically

npm run build

Build the module to /dist folder. It will be used to publish to npm, and can be used in other express server

npm run build:doc

Build the api document page

How to integrate this module to Express server

The module exports an express router, you can simply use the following code to integrate it to your express server:

const express = require('express');
const app = express();
 
const serviceModule = require('dd-cognitive-service-module-ui'); // Note: for now it is not published to npm yet
 
const rootServicePath = '/api/v1';
app.use(rootServicePath, serviceModule({
  backendUrl: 'http://localhost:3000'
}));

How to deploy app to Bluemix

  1. Run the following command to set your API endpoint, replacing the API-endpoint value with the API endpoint for your region.
cf api <API-endpoint>
API endpoint Region
https://api.ng.bluemix.net US South
https://api.eu-gb.bluemix.net United Kingdom
https://api.au-syd.bluemix.net Sydney
  1. Log in to your Bluemix account.
cf login
  1. From within the app directory, push the app to Bluemix.
cf push