The API for pokedextracker.com. It's written in Node.js v5 using the following libraries/packages:
- Hapi - API Framework
- Joi - Data Validator
- Bookshelf - ORM
- Knex - SQL Query Builder
- Bcrypt - Password Hasher
- JWT - JSON Web Token
This project is meant to be run with Node.js v5, so make sure you have it installed and active when running this application. Assuming you have nvm installed, you just need to install v5 and then install the dependencies:
$ nvm install 5
$ nvm use 5
$ cd api.pokedextracker.com
$ npm i
If you have avn setup, the .node-version
file should automatically switch the version for you.
This project uses PostgreSQL as it's database, so you'll need to have the role and database setup. Assuming you already have it installed (either through brew
on OS X or apt-get
on Ubuntu), you can just run the following:
$ psql postgres
postgres=# CREATE ROLE "pokedex_tracker_user" CREATEDB CREATEUSER LOGIN;
$ createdb -O pokedex_tracker_user pokedex_tracker
This repo doesn't include a way to completely load up the DB with all of the actual Pokemon data. That's only been loaded into the production DB. For testing purposes and to make sure everything is functioning as expected, having that data isn't entirely necessary. You should be relying on tests and factories instead of the DB state.
This project uses Mocha as the test runner, Chai BDD as our assertion library, and Istanbul to track code coverage. To run the tests locally, all you need to do is run:
$ npm test
It will output the results of the test, and a coverage summary. To see a line-by-line breakdown of coverage to see what you missed, you should open ./coverage/lcov-report/index.html
.