Skip to content

Commit 774a1e9

Browse files
authored
Merge pull request #1 from IBM/readme
readme updates
2 parents 820fd90 + 77689b1 commit 774a1e9

File tree

4 files changed

+1564
-8
lines changed

4 files changed

+1564
-8
lines changed

README.md

Lines changed: 95 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,97 @@
1-
# StoreFrontHouse
1+
# Create a CRUD application using Node.js and IBM Db2 Warehouse on Cloud
22

3+
This is an application which uses Node.js to connect to IBM Db2 Warehouse on Cloud for CRUD(create, update, delete) operations. The application showcases how you can create a high performant CRUD application using Node.js and IBM Db2 Warehouse on Cloud.
34

4-
# How To Run Project
5-
1. Open two terminal windows
6-
2. cd StoreFrontMLEngineerTrack in both terminals
7-
3. run npm install
8-
4. run yarn install
9-
5. ng serve --open in one terminal
10-
6. node server.js in the other terminal
5+
## Flow
6+
7+
> ![Architecture Diagram](doc/source/images/architecture.png)
8+
9+
1. Create schema and tables necessary for storing data in IBM Db2 Warehouse on Cloud.
10+
2. Node.js webapp that use node Db2 driver to connect to the database.
11+
3. Node.js app exposes API to interact with IBM Db2 Warehouse on Cloud.
12+
4. An Angular frontend application to collect home sales data and call API to store that data to IBM Db2 Warehouse on Cloud.
13+
14+
## Steps
15+
16+
1. [Clone the repo](#1-clone-the-repo)
17+
1. [Create IBM Db2 Warehouse on Cloud](#2-create-ibm-db2-warehouse-on-cloud)
18+
1. [Create schema and tables](#3-create-schema-and-tables)
19+
1. [Add Db2 credentials to .env file](#4-add-db2-credentials-to-env-file)
20+
1. [Run the application](#5-run-the-application)
21+
22+
### 1. Clone the repo
23+
24+
```bash
25+
git clone https://github.com/IBM/crud-using-nodejs-and-db2.git
26+
```
27+
28+
### 2. Create IBM Db2 Warehouse on Cloud
29+
30+
Create the Db2 Warehouse on Cloud service and make sure to note the credentials using the following link:
31+
32+
* [**IBM Db2 Warehouse on Cloud**](https://cloud.ibm.com/catalog/services/db2-warehouse)
33+
34+
### 3. Create schema and tables
35+
36+
In the Db2 warehouse resource page, click on `Manage` and go to DB2 console by clicking the button `Open Console`. In the console do the following to load your data.
37+
38+
* Click `Load` from the hamburger menu.
39+
* Click `Browse files` or you can drag files, select the [data/home-sales-training-data.csv](data/home-sales-training-data.csv) and click `Next`
40+
* Choose existing schema or create a new one named `DB2WML` by clicking `+ New Schema`
41+
* Create a new table named `HOME_SALES` by clicking `+ New Table` on the schema you created and click `Next`
42+
* Make sure the column names and data types displayed are correct, then cick `Next`
43+
* Click `Begin Load` to load the data
44+
45+
Once this is done it will create a table `HOME_SALES` under schema `DB2WML` which will be used by the Node.js application.
46+
47+
### 4. Add Db2 credentials to .env file
48+
49+
Copy the local `env.sample` file and rename it `.env`:
50+
51+
```bash
52+
cp env.sample .env
53+
```
54+
55+
Update the `.env` file with the credentials from your Assistant service.
56+
57+
```bash
58+
# Copy this file to .env and replace the credentials with
59+
# your own before starting the app.
60+
61+
DB_DATABASE=<database name>
62+
DB_HOSTNAME=<hostname>
63+
DB_PORT=50000
64+
DB_UID=<username>
65+
DB_PWD=<password>
66+
```
67+
68+
### 5. Run the application
69+
70+
```bash
71+
npm install
72+
yarn install
73+
```
74+
75+
In a two separate terminals run the following:
76+
77+
```bash
78+
ng serve --open
79+
```
80+
81+
and
82+
83+
```bash
84+
node server.js
85+
```
86+
87+
You can go to the UI by running the following URL in the browser: `http://localhost:8888`
88+
89+
## Learn more
90+
91+
* **Artificial Intelligence Code Patterns**: Enjoyed this Code Pattern? Check out our other [AI Code Patterns](https://developer.ibm.com/technologies/artificial-intelligence/)
92+
93+
## License
94+
95+
This code pattern is licensed under the Apache License, Version 2. Separate third-party code objects invoked within this code pattern are licensed by their respective providers pursuant to their own separate licenses. Contributions are subject to the [Developer Certificate of Origin, Version 1.1](https://developercertificate.org/) and the [Apache License, Version 2](https://www.apache.org/licenses/LICENSE-2.0.txt).
96+
97+
[Apache License FAQ](https://www.apache.org/foundation/license-faq.html#WhatDoesItMEAN)

0 commit comments

Comments
 (0)