Clone the datarink repository:
git clone https://github.com/kevkan/datarink
cd datarink
Install dependencies with npm:
npm installdatarink uses Postgres for storing data. There are two popular options for installing Postgres: Homebrew, and Postgres.app.
If you don't already have Homebrew, install it:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"Once Homebrew is installed Postgres can be installed with:
brew update
brew install postgresTo boot Postgres and have it run in the background:
pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log startTo stop Postgres :
pg_ctl -D /usr/local/var/postgres stop -s -m fastIf you're using Postgres a bunch it's likely worth setting your computer to have it run when your computer starts up. You can find out how to set that up with LaunchAgents.
An alternative way to install Postgres is through Postgres.app. Follow the instructions on the download page to install it.
Now that Postgres is installed and running you'll need to download the pgAdmin client as a GUI to manage your Postgres databases. Download pgAdmin.
Once installed you can create a database called datarink. You'll also need to specify a username and password for the data that you'll use later when setting up the app's environment variables.
Once you have a database called datarink, you'll need to setup its structure. The queries for the structure can be found in table-creation-queries.md.
Once you've run the above queries in pgAdmin's Query Tool you'll need to populate the database with data. Do this using the node-game-scraper repo. node-game-scraper scrapes data from a few sources and inserts it into the correct columns and tables in the Postgres database. Make sure your local node-game-scraper is pointed to the datarink database that was just created before scraping.
If you're running the app locally (not through Heroku), you'll need to define environment variables for the app to properly connect to the local database. Update the sample.sample-env file to use your own Postgres database URL and then re-save it as .env in the root of the app.
The local database URL should look like:
HEROKU_POSTGRESQL_COPPER_URL = "postgres://<username>:<password>@<host>:<port>/<databasename>"If you want an extra level of security you can fill out the AUTHENTICATION variables. If not needed just set it to off.
Note: if you're connecting to a local Postgres database you may need to change the ssl key in the pgConfig object defined in server.js to false.
Now that you have a database connected to the datarink app you can start it by running:
heroku local webFor style changes you'll need a SASS to CSS compiler. An easy one to get running is the sass npm module. You can install it globally with:
npm install -g sassNow you can run sass --watch style.scss:style.css in the /public directory to have it compile as you make changes to style.scss.