Our intended user is a store owner who wishes to see his/her Amppazon analytics. Specifically his/her
- Bestsellers
- List of customers by spend
- Sales for the current year
- Sales to date
We started with our architecture professionally depicted below:
- Clone the repository
- Run
npm install
- create a
config.env
and aconfig-test.env
- Add the
DB_URL
variable (gitter channel FAC10) - run
npm run dev
to run the project - run
npm test
to run tests
- To run a build or sql script locally you can run
\i {name of your build script}
- We wanted to ensure that we knew what our database queries would return without damaging our production database.
- We created a fake database by first duplicating the build process with a different URL/connection to elephant sql.
In config.env
DB_URL=postgres://usernameHere:passwordJere@stampy.db.elephantsql.com:5432/dbName
In config-test.env
DB_URL=postgres://otherusername:otherPassword@stampy.db.elephantsql.com:5432/testDatabase
- We then set up an
process.env
variable we calledENV
which we set equal toTEST
- We then check in our build connection file whether this variable exist and set the call to
env2
using this.
const environment = require('env2');
if (process.env.ENV === 'TEST') {
environment('config-test.env');
} else {
environment('config.env');
}
- We then run npm test with the following commands in our package.json
"pretest": "ENV=TEST node test-database/db_build_test.js",
"test": "node test-database/tests.js | tap-spec"