Skip to content

Latest commit

 

History

History
121 lines (92 loc) · 4.34 KB

README.md

File metadata and controls

121 lines (92 loc) · 4.34 KB

PokerLeagueAPI

Web services API for the PokerLeague mobile app.

PokerLeage Mobile App Project

This project, PokerLeagueAPI, is the web services platform that drives the PokerLeague mobile app. Check out the Ionic/Cordova mobile app for this API at https://github.com/tmichalski/PokerLeague/.

Coding Standards

Following the coding standards for the following core frameworks of this app.

Read up on Promise Anti-Patterns (AND AVOID THESE!)

Developer Setup

Setup Database

Install MySQL database

Install MySQL Workbench

Create a MySQL database and user called "pokerleague" to match the database configuration found in /db/knexfile.js

    host: '127.0.0.1',
    user: 'pokerleague',
    password: 'pokerleague',
    database: 'pokerleague'
}```

The database tables/seed migration scripts rely on the Knex API.

Install the Knex command line npm module before executing the following commands.

$ npm install -g knex

Generate tables

$ cd /my/workspace/PokerLeagueAPI/db

$ knex migrate:latest

Load seed data for testing

$ cd /my/workspace/PokerLeagueAPI/db

$ knex seed:run

Drop Tables

$ cd /my/workspace/PokerLeagueAPI/db

$ knex migrate:rollback

Setup App

Install Node Package Manager (npm)

Clone the PokerLeagueAPI project locally (assumes you already have git installed)

$ cd /my/workspace

$ git clone https://github.com/tmichalski/PokerLeagueAPI.git

$ cd /my/workspace/PokerLeagueAPI

Install app dependencies

$ npm install

Install Nodemon for live reload

$ npm install -g nodemon

Run App

Be sure you have setup your local database and configured it within /db/knexfile.js

Run using Nodemon live reload

$ cd /my/workspace/PokerLeagueAPI

$ nodemon server.js

Run using stock NodeJS

$ cd /my/workspace/PokerLeagueAPI

$ node server.js

IDE: JetBrains WebStorm / IntelliJ IDEA

  • IntellJ IDE > Preferences > Plugins > Browse Repositories... and install the following plugins:
    • NodeJS
  • Nodemon Run Configuration:
    • Run > Edit Configurations
    • Click the "+" sign to add a new configuration
    • Choose "NodeJS" from the "+" drop-down list
    • Enter the following options
      • Name: Nodemon
      • Node interpreter: /usr/local/bin/node (Project) <-- choose in drop-down, should be default
      • Node parameters: /usr/loca/bin/nodemon
      • Working directory: (ie /Users/tim/Documents/workspace/PokerLeagueAPI)
      • JavaScript file: server.js
      • Environment Variables:
        • FACEBOOK_APP_ID: get your own or ask @tmichalski
        • FACEBOOK_APP_SECRET: get your own or ask @tmichalski
    • Click "Ok" to save
  • Node Run Configuration:
    • Run > Edit Configurations
    • Click the "+" sign to add a new configuration
    • Choose "NodeJS" from the "+" drop-down list
    • Enter the following options
      • Name: Node
      • Node interpreter: /usr/local/bin/node (Project) <-- choose in drop-down, should be default
      • Working directory: (ie /Users/tim/Documents/workspace/PokerLeagueAPI)
      • JavaScript file: server.js
      • Environment Variables:
        • FACEBOOK_APP_ID: get your own or ask @tmichalski
        • FACEBOOK_APP_SECRET: get your own or ask @tmichalski
    • Click "Ok" to save
  • PLAY/RUN:
    • In the "Run" drop-down list in the main toolbar, select your run option and click the green "Play" button to launch the app.
    • Be sure the PokerLeagueAPI app is running and listening on whatever hostname:port is configured in /www/app/app.config.js
  • DEBUG:
    • Click the bug icon instead of the green triangle play button to initiate debug
    • Use "Node" run configuration for debug
    • Nodemon doesn't play nice with IntelliJ/WebStorm Debug mode