API for Wave Witness King Tides
-
Create a file named
config.json
and add the following content (FLICKR_OAUTH_KEY and FLICKR_OAUTH_SECRET intentionally left blank for initial creation):{ "MONGO_URL": "mongodb://user:pwd@localhost:27017/db", "FLICKR_KEY": "flickr_api_key", "FLICKR_SECRET": "flickr_shared_secret", "FLICKR_USER_ID":"witnesskingtides", "FLICKR_OAUTH_KEY":"", "FLICKR_OAUTH_SECRET":"", "WKT_CORS_WHITELIST": "http://localhost,https://localhost:5000" }
-
Install dependencies
npm install
-
Fill in FLICKR_USER_ID with your Flickr web address (this is used for the photo search)
https://www.flickr.com/photos/FLICKR_USER_ID
Create / Find your Flickr web address via
https://www.flickr.com/account
Alternatively you can use the unique ID in Step 5 below when authorizing Flickr
-
Fill in FLICKR_KEY and FLICKR_SECRET
Find/Create existing keys at
https://www.flickr.com/services/apps/
-
Authorize Flickr to get FLICKR_OAUTH_KEY and FLICKR_OAUTH_SECRET (this is used for the photo upload)
node scripts/flickr_auth.js
Follow instructions and update config.json based on output.
Note: this will create a private photo in your Flickr Camera Roll. Delete it if necessary.
-
Configure WKT_CORS_WHITELIST with the URL where you front end is coming from. Comma separate URLs. Specify ports if necesasry.
Sample code for front end:
https://github.com/rhok-melbourne/witnesskingtides-web/
-
Run server
npm start
or
nodejs bin/www
After updating Flickr config run this to ensure upload process works
node scripts/flickr_test_upload.js
If there is no data at all, use this to get started
cd other
ruby seed_tides.rb