- JavaScript
- Mongoose
- Cheerio
- Axios
- Ensure you have MongoDB running locally or on a remote cloud server.
- Ensure you have
MONGO_HOSTNAME
andMONGO_DATABASE_NAME
set as environmental variables on your machine
$ npm install
$ MONGO_HOSTNAME=localhost MONGO_DATABASE_NAME=boardgamegeek node index.js
Setting the environment variable DEBUGGING
to true
will switch the application into debug mode.
DEBUGGING is dangerous and results in the database being dropped, only debug when you are NOT connected to a production database
$ MONGO_HOSTNAME=localhost MONGO_DATABASE_NAME=boardgamegeek DEBUGGING=true node index.js
- Database connection is opened
- We iterate up to "page number", delaying each iterations exponentially by 10000ms
- We fetch the list of games by index number (returns 100 games per request)
- We parse the catalogue, extracting information about each game
- For each game we fetch its details and build a model
- Finally we persist the model into MongoDB