Use the IBM Watson Discovery service to add a cognitive search and content analytics engine to your applications to identify patterns, trends and actionable insights that drive better decision-making.
Demo: https://discovery-news-demo.mybluemix.net/
-
You need a Bluemix account. If you don't have one, sign up.
-
Download and install the Cloud-foundry CLI tool if you haven't already.
-
Connect to Bluemix with the command line tool.
cf api https://api.ng.bluemix.net
cf login
- Create and retrieve service keys to access the Discovery service:
cf create-service discovery standard my-discovery-service
cf create-service-key my-discovery-service myKey
cf service-key my-discovery-service myKey
- Create an
.env
file in the root directory by copying the sample.env.example
file using the following command:
cp .env.example .env
Update the .env
with your service instance information from step 4
The .env
file will look something like the following:
DISCOVERY_USERNAME=<username>
DISCOVERY_PASSWORD=<password>
- Install the needed application dependencies with this command:
npm install
- Start the application locally:
npm start
-
Point your browser to http://localhost:3000.
-
Create a
manifest.yml
in the project directory that looks like this:name: <your application name> command: npm start services: - my-discovery-service
-
When you're ready, push the application to Bluemix and bind your Discovery service with:
cf push <your application name>
After completing these steps, you are ready to test your application. Start a browser and enter the URL of your application.
<your application name>.mybluemix.net
For more details about developing applications that use Watson Developer Cloud services in Bluemix, see Getting started with Watson Developer Cloud and Bluemix.
-
The main source of troubleshooting and recovery information is the Bluemix log. To view the log, run this command:
cf logs <your application name> --recent
-
For more details about the service, see the documentation for the Discovery service.
-
Hot Reload is recommended for developing changes.
- This will allow changes to the code to immediately be reflected on the locally running instance of the application, rather than manually rebooting it.
- Install and use this according to the instructions found in the readme.
.
├── app.js // express routes
├── config // express configuration
│ ├── error-handler.js
│ ├── express.js
│ └── security.js
├── package.json
├── public // static resources
├── server.js // entry point
├── test // tests
└── views // react components
This sample code is licensed under Apache 2.0.
See CONTRIBUTING.
Find more open source projects on the IBM Github Page
Sample web applications that include this package may be configured to track deployments to IBM Bluemix and other Cloud Foundry platforms. The following information is sent to a Deployment Tracker service on each deployment:
- Node.js package version
- Node.js repository URL
- Application Name (
application_name
) - Space ID (
space_id
) - Application Version (
application_version
) - Application URIs (
application_uris
) - Labels of bound services
- Number of instances for each bound service and associated plan information
This data is collected from the package.json
file in the sample application and the VCAP_APPLICATION
and VCAP_SERVICES
environment variables in IBM Bluemix and other Cloud Foundry platforms. This data is used by IBM to track metrics around deployments of sample applications to IBM Bluemix to measure the usefulness of our examples, so that we can continuously improve the content we offer to you. Only deployments of sample applications that include code to ping the Deployment Tracker service will be tracked.