INACTIVE - http://mzl.la/ghe-archive - To infinity and beyond. The backend API.
Перейти к файлу
Charles Chong 399ae66f51 Fixed minor bug with gameByDevIDs on game creation 2014-03-25 09:10:23 -07:00
lib Fixed minor bug with gameByDevIDs on game creation 2014-03-25 09:10:23 -07:00
scripts Reordered library import statements 2014-03-24 00:47:32 +08:00
static Bust host.html on each load 2013-12-20 14:31:35 -08:00
views Changed user to developer in variable names 2014-03-25 05:39:24 -07:00
.gitignore deploy on stackato (fixes #136) 2014-03-10 20:53:56 -07:00
README.md Updated instructions, and change db-prefill to runnable script 2014-03-23 19:18:14 +08:00
app.js link to docs @ / 2014-03-10 21:27:18 -07:00
db.js Modified redisView in db.js to close redis connections with `client.quit()` instead of `client.end()`, since that is what the documentation recommends. This avoids prematurely closing the connection if a request is still awaiting a reply. See https://github.com/mranney/node_redis#clientend. 2014-03-23 11:37:43 -07:00
game.html Fix game stub URL 2013-12-20 12:23:32 -08:00
package.json Added persona-faker as a dev dependency so that it can be launched using a script 2014-02-09 09:15:06 -08:00
server_http.js Send the actual error as part of an exception response only when settings.DEBUG is enabled 2014-03-18 11:42:11 -07:00
server_ws.js fix auth import 2014-02-07 21:42:40 -05:00
settings.js Added persona-faker as a dev dependency so that it can be launched using a script 2014-02-09 09:15:06 -08:00
settings_local.js.dist Updated the prefill data to include game details, and more games 2014-03-23 19:06:07 +08:00
stackato.yml deploy on stackato (fixes #136) 2014-03-10 20:53:56 -07:00

README.md

galaxy-api

Stories in Ready

Here lives the API that is consumed by the front-end interface for cvan/galaxy.

Installation

# 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

Deployment

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

Sample Usage

Game Submission

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"]}'

Game Details

curl 'http://localhost:5000/game/nutty-ninjas/detail'

Grant a user admin privileges

./scripts/addusertogroup.js cvan@mozilla.com admin

Grant a user admin+reviewer privileges

./scripts/addusertogroup.js cvan@mozilla.com admin reviewer

Revoke a user's admin privileges

./scripts/removeuserfromgroup.js cvan@mozilla.com admin

Revoke a user's admin+reviewer privileges

./scripts/removeuserfromgroup.js cvan@mozilla.com admin reviewer

Using prefilled data

./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;