-
Notifications
You must be signed in to change notification settings - Fork 37
Running Locally
biosopher edited this page Nov 4, 2015
·
17 revisions
- 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.
-
Enter these credentials into app.js.
The section below shows where you need to do this. Replace<username>
and<password>
for both NLC & Dialog services with appropriate username and password from each service that you obtained in the prior step.var dialogCredentials = extend({ url: "https://gateway.watsonplatform.net/dialog/api", username: "<username>", password: "<password>" }, bluemix.getServiceCreds('dialog')); // VCAP_SERVICES // if bluemix credentials exists, then override local var nlcCredentials = extend({ "url": "https://gateway.watsonplatform.net/natural-language-classifier/api", username: "<username>", password: "<password>" }, bluemix.getServiceCreds('nlc')); // VCAP_SERVICES
-
Download and install Node.js and npm.
-
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
- Run the following command to start the application:
node app.js
- Point your browser to http://localhost:3000.
Invalid Credentials?
If you see this error, you likely did not enter your service credentials properly.