This server will serve the API needed for DD Stats to work properly.
Go to file
2021-10-11 20:39:38 +02:00
api Fixed bad p+arameter name. 2021-10-11 20:22:22 +02:00
libs Now imports points... 2021-10-11 19:37:37 +02:00
schemas Add more post processing tasks (points) 2021-10-09 23:22:56 +02:00
.gitignore Added ability to parse players.msgpack 2021-10-09 19:26:30 +02:00
dotenv-template Basic player API. 2021-10-03 19:00:41 +02:00
index.js Added JSDoc comments. 2021-10-06 20:36:20 +02:00
LICENSE Initial commit 2021-09-25 11:47:20 +02:00
package.json Added ability to parse players.msgpack 2021-10-09 19:26:30 +02:00
README.md Added documentation in README.md. 2021-10-11 20:39:38 +02:00

ddstats-server

This server will serve the API needed for DD Stats to work properly.

API Reference

Maps

Map count: /api/maps/count

Returns the total amount of maps.

Example output:

{
  "success": true,
  "response": 2028
}

Get specific map: /api/maps/get/:map

Returns the map (if found in the database). map has to be the full map name and URL encoded.

Example output (/api/maps/get/1Hook):

{
  "success": true,
  "response": {
    "_id": "6154a3a3db94330b8f12682e",
    "name": "1Hook",
    "mapper": "Starkiller",
    "release": "2020-11-15T14:00:00.000Z",
    "category": "Race",
    "rating": 5,
    "awardPoints": 10,
    "__v": 0,
    "totalFinishes": 42
  }
}

Example output (/api/maps/get/1ook):

{
  "success": false,
  "response": "No map found!"
}

Get all maps: /api/maps/getAll

Returns all maps from the database.

Get a category: /api/maps/category/:category

Returns all maps from category from the database.

Valid categories:

  • Novice
  • Moderate
  • Brutal
  • Insane
  • Dummy
  • DDMaX
  • Oldschool
  • Solo
  • Race
  • Fun

Players

Player count: /api/players/count

Returns the total amount of players.

Example output:

{
  "success": true,
  "response": 465362
}

Get specific player: /api/players/get/:player

Returns the player (if found in the database). player has to be the full player name and URL encoded.

Example output (/api/players/get/Yumiko):

{
  "success": true,
  "response": {
    "_id": "6158a7f96f251f358de0e78e",
    "name": "Yumiko",
    "firstFinish": "2015-07-14T22:52:24.000Z",
    "__v": 0,
    "points": 5944,
    "rankPoints": 356,
    "teamPoints": 171,
    "pointsThisWeek": 257
  }
}

Example output (/api/players/get/Yumi):

{
  "success": false,
  "response": "No player found!"
}

Searching

You can search both for players and maps in a more advanced way. You can provide a case-insensitive regex or search term to get all matching entries. This is, however, paginated...

  • Search for player: /api/players/search?q=name
  • Search for map: /api/maps/search?q=name

Options (queries)

These are queries you can use:

  • q : [String | RegExp] → This is the actual search term or regex.
  • sort : [String = field_name] → This chooses what field to sort by. Some example fields:
    • name (player or map)
    • points (player)
    • releaseDate (map)
  • order : [String = asc | desc] → This chooses between ordering it by ascending or descending order.
  • page : [Int = page_num] → This chooses what page to load in.
  • byMapper : [Boolean] (only for maps) → Searches by the mapper's name instead of by the map's name.

Examples

  • /api/players/search?q=Yumiko&sort=points&order=desc would search for players with Yumiko in their names, sort by their points in descending order (the one wiht the most points first).
  • /api/players/search?q=burnyllama would search for players with burnyllama in their names.
  • /api/players/search?q=^[0-9] would search for players with a name begining with a number.