Giter Site home page Giter Site logo

apiserver's Introduction

Playtomic API Server

This is the API server for the Playtomic tools.

Playtomic is a collection of open source tools for games like leaderboards, user created content and dynamic content.

Setup instructions and help are available at:

apiserver's People

Contributors

benlowry avatar oddgames-david avatar starburst997 avatar zentuit avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

apiserver's Issues

What's with base64 encoding?

I'm wondering why json string are being base64 encoded? At first, I thought it was for compression but it makes the data bigger.

Heroku start error

Hi,

I am having some errors when trying to start the server on Heroku.
I followed the steps on the "Setup Server" page ("Nearly instant setup").

  1. I had an error trying to connect to MonogoDB. Fixed by adding the MONGOHQ_URL to the config vars (just copied the MONGODB_URI var).
  2. All the collections are now created but at startup I have the following error message:
2016-07-21T09:26:23.092196+00:00 heroku[web.1]: Starting process with command `node web.js`
2016-07-21T09:26:25.473398+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2016-07-21T09:26:26.821527+00:00 app[web.1]: Listening on 36678, env: production, local: false
2016-07-21T09:26:26.908267+00:00 app[web.1]: EXCEPTION: 
2016-07-21T09:26:27.735291+00:00 heroku[web.1]: Process exited with status 143
2016-07-21T09:26:27.473934+00:00 heroku[web.1]: State changed from starting to up
2016-07-21T09:26:29.142508+00:00 app[web.1]: { [MongoError: not authorized on heroku_mn3xtgkc to execute command { listCollections: true, filter: { name: "games" }, cursor: {} }]
2016-07-21T09:26:29.142520+00:00 app[web.1]:   name: 'MongoError',
2016-07-21T09:26:29.150835+00:00 app[web.1]:   name: 'MongoError',
2016-07-21T09:26:29.153312+00:00 app[web.1]:   ok: 0,
2016-07-21T09:26:29.153313+00:00 app[web.1]:   errmsg: 'not authorized on heroku_mn3xtgkc to execute command { listCollections: true, filter: { name: "playerlevel_levels" }, cursor: {} }',
2016-07-21T09:26:29.181467+00:00 app[web.1]:   connectionId: 58716,
2016-07-21T09:26:29.186617+00:00 app[web.1]:   err: 'not authorized on heroku_mn3xtgkc to execute command { createIndexes: "playerlevel_levels", indexes: [ { key: { publickey: 1, date: -1 }, name: "publickey_1_date_-1", unique: false } ] }',
2016-07-21T09:26:29.193902+00:00 app[web.1]:   ok: 1 }
2016-07-21T09:26:29.211962+00:00 app[web.1]:   ok: 1 }
2016-07-21T09:26:29.216330+00:00 app[web.1]:   code: 13,
2016-07-21T09:26:29.216331+00:00 app[web.1]:   n: 0,
2016-07-21T09:26:29.216332+00:00 app[web.1]:   ok: 1 }
2016-07-21T09:26:29.221342+00:00 app[web.1]: { [MongoError: not authorized on heroku_mn3xtgkc to execute command { createIndexes: "achievements_players", indexes: [ { key: { publickey: 1, playerid: 1 }, name: "publickey_1_playerid_1", unique: false } ] }]
2016-07-21T09:26:29.221345+00:00 app[web.1]:   name: 'MongoError',
2016-07-21T09:26:29.221347+00:00 app[web.1]:   connectionId: 58719,
2016-07-21T09:26:29.221348+00:00 app[web.1]:   err: 'not authorized on heroku_mn3xtgkc to execute command { createIndexes: "achievements_players", indexes: [ { key: { publickey: 1, playerid: 1 }, name: "publickey_1_playerid_1", unique: false } ] }',
2016-07-21T09:26:29.221349+00:00 app[web.1]:   code: 13,
2016-07-21T09:26:29.221349+00:00 app[web.1]:   n: 0,
2016-07-21T09:26:29.216330+00:00 app[web.1]:   code: 13,
2016-07-21T09:26:29.216332+00:00 app[web.1]:   ok: 1 }
2016-07-21T09:26:29.221342+00:00 app[web.1]: { [MongoError: not authorized on heroku_mn3xtgkc to execute command { createIndexes: "achievements_players", indexes: [ { key: { publickey: 1, playerid: 1 }, name: "publickey_1_playerid_1", unique: false } ] }]
2016-07-21T09:26:29.221345+00:00 app[web.1]:   name: 'MongoError',
2016-07-21T09:26:29.221346+00:00 app[web.1]:   lastOp: { _bsontype: 'Timestamp', low_: 0, high_: 0 },
2016-07-21T09:26:29.221348+00:00 app[web.1]:   err: 'not authorized on heroku_mn3xtgkc to execute command { createIndexes: "achievements_players", indexes: [ { key: { publickey: 1, playerid: 1 }, name: "publickey_1_playerid_1", unique: false } ] }',
2016-07-21T09:26:29.221349+00:00 app[web.1]:   n: 0,
2016-07-21T09:26:29.221350+00:00 app[web.1]:   ok: 1 }
2016-07-21T09:26:29.216330+00:00 app[web.1]:   code: 13,
2016-07-21T09:26:29.216331+00:00 app[web.1]:   n: 0,
2016-07-21T09:26:29.221342+00:00 app[web.1]: { [MongoError: not authorized on heroku_mn3xtgkc to execute command { createIndexes: "achievements_players", indexes: [ { key: { publickey: 1, playerid: 1 }, name: "publickey_1_playerid_1", unique: false } ] }]
2016-07-21T09:26:29.221347+00:00 app[web.1]:   connectionId: 58719,
2016-07-21T09:26:29.221348+00:00 app[web.1]:   err: 'not authorized on heroku_mn3xtgkc to execute command { createIndexes: "achievements_players", indexes: [ { key: { publickey: 1, playerid: 1 }, name: "publickey_1_playerid_1", unique: false } ] }',
2016-07-21T09:26:29.221349+00:00 app[web.1]:   code: 13,
2016-07-21T09:26:29.221349+00:00 app[web.1]:   n: 0,
2016-07-21T09:26:29.216330+00:00 app[web.1]:   code: 13,
2016-07-21T09:26:29.216331+00:00 app[web.1]:   n: 0,
2016-07-21T09:26:29.216332+00:00 app[web.1]:   ok: 1 }
2016-07-21T09:26:29.221342+00:00 app[web.1]: { [MongoError: not authorized on heroku_mn3xtgkc to execute command { createIndexes: "achievements_players", indexes: [ { key: { publickey: 1, playerid: 1 }, name: "publickey_1_playerid_1", unique: false } ] }]
2016-07-21T09:26:29.221345+00:00 app[web.1]:   name: 'MongoError',
2016-07-21T09:26:29.221346+00:00 app[web.1]:   lastOp: { _bsontype: 'Timestamp', low_: 0, high_: 0 },
2016-07-21T09:26:29.221348+00:00 app[web.1]:   err: 'not authorized on heroku_mn3xtgkc to execute command { createIndexes: "achievements_players", indexes: [ { key: { publickey: 1, playerid: 1 }, name: "publickey_1_playerid_1", unique: false } ] }',
2016-07-21T09:26:29.221349+00:00 app[web.1]:   code: 13,
2016-07-21T09:26:29.221349+00:00 app[web.1]:   n: 0,
2016-07-21T09:26:29.221350+00:00 app[web.1]:   ok: 1 }
2016-07-21T09:26:29.216330+00:00 app[web.1]:   code: 13,
2016-07-21T09:26:29.216331+00:00 app[web.1]:   n: 0,
2016-07-21T09:26:29.216332+00:00 app[web.1]:   ok: 1 }
2016-07-21T09:26:29.221342+00:00 app[web.1]: { [MongoError: not authorized on heroku_mn3xtgkc to execute command { createIndexes: "achievements_players", indexes: [ { key: { publickey: 1, playerid: 1 }, name: "publickey_1_playerid_1", unique: false } ] }]
2016-07-21T09:26:29.221346+00:00 app[web.1]:   lastOp: { _bsontype: 'Timestamp', low_: 0, high_: 0 },
2016-07-21T09:26:29.221348+00:00 app[web.1]:   err: 'not authorized on heroku_mn3xtgkc to execute command { createIndexes: "achievements_players", indexes: [ { key: { publickey: 1, playerid: 1 }, name: "publickey_1_playerid_1", unique: false } ] }',
2016-07-21T09:26:29.221349+00:00 app[web.1]:   n: 0,
2016-07-21T09:26:29.216330+00:00 app[web.1]:   code: 13,
2016-07-21T09:26:29.216331+00:00 app[web.1]:   n: 0,
2016-07-21T09:26:29.221345+00:00 app[web.1]:   name: 'MongoError',
2016-07-21T09:26:29.221348+00:00 app[web.1]:   err: 'not authorized on heroku_mn3xtgkc to execute command { createIndexes: "achievements_players", indexes: [ { key: { publickey: 1, playerid: 1 }, name: "publickey_1_playerid_1", unique: false } ] }',
2016-07-21T09:26:29.221349+00:00 app[web.1]:   n: 0,
2016-07-21T09:26:29.221350+00:00 app[web.1]:   ok: 1 }
2016-07-21T09:26:29.216330+00:00 app[web.1]:   code: 13,
2016-07-21T09:26:29.216332+00:00 app[web.1]:   ok: 1 }
2016-07-21T09:26:29.221345+00:00 app[web.1]:   name: 'MongoError'

I have zero knowledge on Mongo or Heroku, if you require more informations just ask and I will do my best to find what you need.

Thank you.

How to deploy the server manually?

What are the steps I should follow manually deploy the server?
The instructions in here: http://playtomic.org/server.html are only for an Heroku installation and I want to put it on openshift...
So once I have downloaded and copied the git source on my openshift application, what am I supposed to do? Is there any config file I must change or something?

get PlayerLevel rating?

Hi Ben

I am currently looking at the server scripts and I have a question regarding playerlevel rating. In the playerslevel.list function, there is an option to sort levels by player ratings that seems to sort levels using a "rating" field:

switch(options.mode) {
case "alltime":
case "popular": // legacy
query.sort = "-rating";
break;
.....

However, levels do not have a rating field (only a ratings one wich is an array) so I do not really understand how it is supposed to work (I am new to mongoDB thouth so maybe there is a subtility I do not understand). Looking at the playerlevels objects structure in mongodb, I would say the alltime rating can only be obtained doing: score/votes

Also, when retrieving player levels with the api, wich field of the returned level object should I look at to get the alltime rating? (is there a rating field return or should I do score/votes?)

Finnaly, I found a bug in the playerlevels.list script. In the rate function, you must change the line

db.PlayerLevel.findOneAndUpdate({_id: doc._id}, doc, { upsert: false }, function(error) {

var docid = doc._id;
delete doc._id;
db.PlayerLevel.findOneAndUpdate({_id: docid}, doc, { upsert: false }, function(error) {

else mongoose return an eror saying: MongoError Mod on _id not allowed

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.