Skip to content

Running Locally

biosopher edited this page Oct 27, 2015 · 17 revisions

Running locally

  1. Download and install Node.js and npm.

  2. Configure the code to connect to your service: i. Copy the credentials from your natural-language-classifier-service service in Bluemix. Run the following command:

$ cf env <application-name>

Example output:

System-Provided:
{
  "VCAP_SERVICES": {
    "natural_language_classifier": [
      {
        "credentials": {
          "password": "<password>",
          "url": "<url>",
          "username": "<username>"
        }
        "label": "natural-language-classifier",
        "name": "natural-language-classifier-service",
        "plan": "free",
        "tags": [
          ... 
        ]
      }
    ]
  }
}

ii. Copy username, password, and url from the credentials. iii. Open the app.js file and paste the username, password, and url credentials for the service. iv. In the app.js file paste the "Classifier ID". Save the app.js file.

  1. Install all packages required by Node.JS i. Change to the new directory that contains the project. ii. Run the following command:node
$ npm install
  1. Run the following command to start the application:
node app.js
  1. Point your browser to http://localhost:3000.

Invalid Credentials? If you see this error, you likely did not enter your service credentials properly.