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/
To deploy this repository as-is, click the "Deploy to Bluemix" button
When this button is clicked, it will begin the process of creating a deployment toolchain based on the master branch of the repo into Bluemix and you will have to modify the application name to the name of the host you want to put it at. The default will get mapped to {organization/user}-{repo_name}-{timestamp}.
After creating the toolchain, you must either run the deployment script as part of the Continuous Delivery which will create the service for you, or refer to the Setup a IBM Watson Discovery Service section below to create it manually.
For more details about developing applications that use Watson Developer Cloud services in Bluemix, see Getting started with Watson Developer Cloud and Bluemix.
-
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 Discovery-Demo cf create-service-key Discovery-Demo myKey cf service-key Discovery-Demo 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 4The
.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:
-
in one tab, run (client runs on port 3000)
npm start
-
in another tab, run (server runs on port 5000)
node server.js
-
Point your browser to http://localhost:3000.
You may build the optimized production build by running npm run build
. Then you only require to run the node server.js
to see your code hosted at http://localhost:5000
-
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.
.
├── app.js // express routes
├── config // express configuration
│ ├── error-handler.js
│ ├── express.js
│ └── security.js
├── package.json
├── public // static resources
├── server.js // entry point
├── test // integration tests
└── src // react client
├── __test__ // unit tests
└── index.js // app entry point
This sample code is licensed under the MIT License.
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.