Revamped backend for datarink
- Run
npm install
. - In
config.js
, specifyDB_HOST
,DB_NAME
,DB_USER_MASTER
, andDB_USER_MASTER_PASSWORD
. - Create database tables by running
node create-tables.js
. - In
config.js
, follow the instructions for creating a database writer role (used by the game scraper). Fill inDB_USER_WRITER
andDB_USER_WRITER_PASSWORD
with this role's name and password. - In
config.js
, follow the instructions for creating a database reader role (used by the API). Fill inDB_USER_READER
andDB_USER_READER_PASSWORD
with this role's name and password. - Populate database using
scrape-games.js
. For example,node scrape-games.js 2016 20001-21230 save
.- Use the
save
flag to save the downloaded json files. Replace this flag withlocal
to use local files. Iflocal
is specified but a file is not found, it will be downloaded and saved. save
andlocal
will save and load data from/scripts/raw-data/
. Theraw-data
folder needs to be created before running the scraper.
- Use the
- Use
npm run dev
to allow cross-origin requests for local development. - To lint JavaScript, run
npm run lint
.