This document shows how to run the watson-discovery-news
application on your local machine.
- Clone the repo
- Create your Watson Discovery service
- Configure Watson Discovery
- Add Watson Discovery credentials
- Run the application
Use the following command to clone the watson-discovery-news GitHub repository.
git clone https://github.com/ibm/watson-discovery-news
To create your Watson Discovery service:
-
Click Create resource on your IBM Cloud dashboard.
-
Search the catalog for Discovery.
-
Click Discovery to launch the create panel.
- From the panel, enter a unique name, a region and resource group, and a plan type (select the default lite plan). Click Create to create and enable your service.
The next step is to configure your Watson Discovery service.
- Find the Discovery service in your IBM Cloud Dashboard.
- Click on the service and then click Launch tool.
The Watson Discovery News data collection is already associated with your service. You'll use this collection as the data source for your app. To access the collection, you must find the COLLECTION_ID
and ENVIRONMENT_ID
. To find these values:
- Click on the collection from the Manage Data panel. In this case, it is named
Watson Discovery News
. - Click on the drop-down icon located in the top right corner of the panel.
Typically, these values need to be added to the application .env file (as shown in the next step), but in the case of Discovery News
, the values are always news-en
(though it might vary based on language) and system
, so you do not need to specify them.
Next, you'll need to add the Watson Discovery credentials to the .env file.
- From the home directory of your cloned local repo, create a .env file by copying it from the sample version.
cp env.sample .env
- Locate the service credentials listed on the home page of your Discovery service.
- Copy and paste the
apikey
andURL
values from your Watson Discovery service credentials into the .env file:
# Watson Discovery
DISCOVERY_URL=<add_discovery_url>
DISCOVERY_APIKEY=<add_discovery_iam_apikey>
Finally, you'll run the application.
npm install
npm start
The application will be available in your browser at http://localhost:3000
.