Giter Club home page Giter Club logo

cncnet-api's People

Contributors

grantbartlett avatar neogrant avatar sean3z avatar tahj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

cncnet-api's Issues

Auth: Refactor

Currently a new entry is created in auth collection per player - duplicating username/password. Ideally, one entry per username/password combo with an array of nicks.

Proposed Auth Object
{
  "id": "ObjectId",
  "username": "String",
  "password": "String",
  "email": "String",
  "nicks": [
    "ObjectId"
  ]
}

Also need to logic to determine that the player passed in Packet or various endpoints, matches the auth username that was passed

Game: Reserve GameId

The API should allow consumers to POST to /ladder/:game/game to reserve a gameId in which stats can be posted to at a later time. Ideally, this should be called only once by the "Host" when they start any game.

The "Host" client can then communicate the "gameId" (from response) to all players within the game.

Example Request

POST /ladder/yr/game HTTP 1.1
Authorization: Basic <hash>

{
  "players": [{
      "nam": "Wingle"
  }],
  "settings": {
    "sped": 0,
    "scen": "Some Map",
    "unit": 1,
    "aipl": 0,
    "crat": 1,
    "base": 1,
    "supr": 0,
    "shrt": 0,
    "cred": 10000,
    "trny": 1
  }
}

Example Successful Response

Request Method: POST
Status Code: 201 Created

{
  "gameId": 1,
  "url": "/ladder/yr/game/1"
}

Switch to JWT for Auth

As it stands, clients must maintain user credentials for auth required endpoints.
Should instead issue a JWT at auth-time and rely on Authorization: Bearer <jwt> scheme

Store HoF data in player object

Create hof (array) property in player object, so it can be easily displayed in the UI

player {
  name: "(string)",
  hof: [
    '(string)', // November 2016
    '(string)' // December 2016
  ]
}

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.