Here lives the API that is consumed by the front-end interface for cvan/galaxy.
# Install redis via homebrew
brew install redis
# Install node dependencies
npm install
# Copy local configuration into place
cp settings_local.js.dist settings_local.js
# Start the server
npm start
If you'd like to run the server for development, consider using nodemon
instead:
npm install nodemon -g
nodemon app.js
For database and authentication settings, this is the process we take for resolving setting values:
- Check for the setting as an environment variable.
- Check for the setting in
settings_local.js
. - Check for the setting in
settings.js
.
We use Redis as a data store. redis://localhost:6379
is the default.
To change the credentials, set an environment variable, like so:
export REDIS_URL='redis://[db-number[:password]@]host:port'
Or use this format:
export REDIS_URL='redis://[[:password]@]host:port/[db-number]'
All fields after the scheme are optional and will default to
localhost
on port 6379
, using database 0
.
We use Persona for authentication.
In production, make sure that these are set correctly:
export DEBUG=''
export ORIGIN='https://api.galaxy.mozilla.org'
export PERSONA_VERIFICATION_URL='https://verifier.login.persona.org/verify'
We use stackato:
stackato push --no-prompt
To start the instance on stackato:
stackato start
To read the logs on stackato:
stackato logs
To run shell commands on stackato:
stackato run cat ../logs/stdout.log
To access the shell on stackato:
stackato ssh
curl -X POST 'http://localhost:5000/game/submit?_user=ssa_token' -H 'Content-Type:application/json' -H 'Accept: application/json' -d '{"app_url":"http://nuttyninjas.com/","artwork":{"background":"background.jpg"},"description":"Nutty Ninjas is a real-time shooter that brings the experience of social multiplayer gaming to a whole new level; it is a console-style game that can be played anywhere and anytime, simply with your computer and mobile devices. Multiple players can join a common gameplay screen just by using their mobile devices, and control their ninja character to unleash dangerous weapons at fellow players!","developer":{"name":"Yang Shun","url":"http://yangshun.im/"},"genre":"action","homepage_url":"http://www.nuttyninjas.com","icons":"http://png-4.findicons.com/files/icons/2297/super_mario/256/paper_mario.png","name":"Nutty Ninjas","privacy_policy_url":"http://una-org.github.io/demos.html","screenshots":["http://www.digitaltrends.com/wp-content/uploads/2011/02/nintendo-new-super-mario-bros-ds-art-screenshot.jpg","http://splitkick.com/wp-content/uploads/2013/01/newsuper2img.jpg","http://www.mariowiki.com/images/f/fc/SuperMarioBrosArtwork2.jpg","http://www.digitaltrends.com/wp-content/uploads/2011/02/nintendo-new-super-mario-bros-ds-art-screenshot.jpg","http://splitkick.com/wp-content/uploads/2013/01/newsuper2img.jpg","http://www.mariowiki.com/images/f/fc/SuperMarioBrosArtwork2.jpg","http://www.digitaltrends.com/wp-content/uploads/2011/02/nintendo-new-super-mario-bros-ds-art-screenshot.jpg","http://splitkick.com/wp-content/uploads/2013/01/newsuper2img.jpg","http://www.mariowiki.com/images/f/fc/SuperMarioBrosArtwork2.jpg"],"slug":"nutty-ninjas","videos":["http://www.youtube.com/embed/4kvT0dywaF8","http://www.youtube.com/embed/1Sow2O8D9Ok"]}'
curl 'http://localhost:5000/game/nutty-ninjas/detail'
./scripts/addusertogroup.js cvan@mozilla.com admin
./scripts/addusertogroup.js cvan@mozilla.com admin reviewer
./scripts/removeuserfromgroup.js cvan@mozilla.com admin
./scripts/removeuserfromgroup.js cvan@mozilla.com admin reviewer
cp scripts/prefillParameters.json.dist scripts/prefillParameters.json
./scripts/db-prefill.js
To flush the db everytime the script is run, add the following to settings_local.js
:
exports.FLUSH_DB_ON_PREFILL = true;
cp settings_test.js.dist settings_test.js
./test/redis_start
make test