This server will serve the API needed for DD Stats to work properly.
Go to file
2021-11-04 22:58:32 +01:00
libs Implemented a way to easily respond render/json. 2021-11-04 21:33:42 +01:00
routes Made the maps-page... 2021-11-04 22:50:57 +01:00
src/sass Made the maps-page... 2021-11-04 22:50:57 +01:00
static Made the maps-page... 2021-11-04 22:50:57 +01:00
tools Begun UI work... 2021-10-30 21:39:21 +02:00
views Started work on map detailed view. 2021-11-04 22:58:32 +01:00
.gitignore Merge branch 'sqlite' 2021-11-04 16:19:18 +01:00
index.js Implemented a way to easily respond render/json. 2021-11-04 21:33:42 +01:00
LICENSE Initial commit 2021-09-25 11:47:20 +02:00
math-func.so Started working on functions for the UI 2021-11-04 15:48:22 +01:00
package.json "make it work" .-. 2021-11-04 19:47:40 +01:00
README.md Added documentation in README.md. 2021-10-11 20:39:38 +02:00
template.env Started reworking API... 2021-11-02 11:32:59 +01: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.