0% found this document useful (0 votes)
42 views7 pages

CDC 1 Cognitive Lab

This document provides steps to configure an app to use the AlchemyAPI service on IBM Bluemix. It describes creating a GitHub repository, cloning sample code, obtaining an API key, running the app locally, and pushing it to Bluemix.

Uploaded by

Antriksh Sharma
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
42 views7 pages

CDC 1 Cognitive Lab

This document provides steps to configure an app to use the AlchemyAPI service on IBM Bluemix. It describes creating a GitHub repository, cloning sample code, obtaining an API key, running the app locally, and pushing it to Bluemix.

Uploaded by

Antriksh Sharma
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Lab:

Configure an app to use AlchemyAPI


Lab: Using AlchemyAPI

Prerequisites
 IBM Bluemix account. Consider subscribing to developerWorks Premium
 A web browser supported by Bluemix:
o Chrome: the latest version for your operating system
o Firefox: the latest version for your operating system and ESR 38
o Internet Explorer: version 11
o Safari: the latest version for the Mac
 Cloud Foundry command line interface, version 6.5.1 or later; it’s recommended that you
use the latest release
 Git Bash and Git GUI
 Node.js

2 Copyright IBM Corporation 2013-2016. All rights reserved.


Lab: Using AlchemyAPI

Step 1. Configure an app to use AlchemyAPI

1. Open the Git UI and create a new repository. Enter a name for the new repository and
click Create.

2. Click Repository > GitBash to open a command prompt.

3. Clone the repository by using the following command:


git clone https://github.com/AlchemyAPI/alchemyapi_node.git
4. Change the directory of your Alchemy folder and then perform an npm installation.

5. You can get a key for Alchemy API through your Bluemix account. Log in to
http://bluemix.net and click on Catalog and type Alchemy in the search bar
6. Click on the AlchemyAPI item to bring up the instance creation panel. Leave the service
unbound and click on Create.
3 Copyright IBM Corporation 2013-2016. All rights reserved.
Lab: Using AlchemyAPI

7. Once the service is created you will see the service control panel. Click on Service
Credentials and then click on the View Credentials pulldown to see your API key. It will
be different than the one shown.

8. Copy the key and run the alchemyapi.js code to enter your API key to configure the
application:

You should see a message saying that you are ready to use AlchemyAPI.

9. Execute the app.js by entering node app.js.


4 Copyright IBM Corporation 2013-2016. All rights reserved.
Lab: Using AlchemyAPI

10. Open a browser to http://localhost:3000 to see the results, which should look like this:

11. The Cloud Foundry CLI tool (cf) is not supported on git bash for Windows. To see the
application running in Bluemix, open a command prompt and change to your Alchemy
folder. Then, change to the alchemyapi_node directory.

12. Set the API to point to IBM Bluemix by using the command cf login -a
https://api.ng.bluemix.net (replacing with your preferred Bluemix region API
endpoint if desired). Then, log in with your IBM ID and password and choose the desired
organization and space for the application.
13. Push this app to Bluemix by using the command cf push application_name. To
avoid a conflicting route, append your initials and the month and year to
alchemyapi_getting_started for application_name.

5 Copyright IBM Corporation 2013-2016. All rights reserved.


Lab: Using AlchemyAPI

The app is now running in Bluemix.


14. Go to the Cloud Foundry App Dashboard and click on the route for the application.

6 Copyright IBM Corporation 2013-2016. All rights reserved.


Lab: Using AlchemyAPI

15. To make changes in the app, change to the files in the folder on your local machine and
save your changes. Use the cf push command to push the app again to Bluemix.

7 Copyright IBM Corporation 2013-2016. All rights reserved.

You might also like