niccokunzmann / prime-breakout-highscore-server

This is a mirror of the GitLab repository to have automatic deployment on Heroku.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Prime Breakout Highscore Server

This server only serves the high score of the game Prime Breakout. Feel free to fork it, modify it and use it.

There is an auto-deployed version running as prime-breakout-highscore.horokuapp.com.

Deployment

You can deploy the app using Heroku. There is a free plan.

Deploy

Heroku uses gunicorn to run the server, see the Procfile.

API

  • /update_highscore.js calls update_highscore(highscore) in the JavaSript file that is delivered
  • /update_highscore.js?scores=[...] same as above additionally adds the high scores listed as a parameter

A highscore is a json of this form:

{
  version: 1, // the version as an integer, increasing as the score is modified
  api_version: 1,
  source: "server.com/update_highscore.js", // the source url
  scores: [
    {
      id: 1, // the local id of a score in an app, not global, as int
      name: "The Developer", // a string
      points: 42 // an integer
    },
    // ... more scores
  ]
}

In case of an error, the result looks like this:

{
  api_version: 1,
  source: "server.com/update_highscore.js", // the source url
  error: {
    "type": "Exception" // the error type
    "message" : "an error occurred" // the message of the error
    "traceback": "file ... line ... " // a multiline message with the error
  }
}

About

This is a mirror of the GitLab repository to have automatic deployment on Heroku.

License:GNU Affero General Public License v3.0


Languages

Language:Python 90.5%Language:HTML 9.0%Language:Procfile 0.6%