Skip to content

Moozdzn/dashboard-routes

Repository files navigation

Society Dashboard Routes

See Moozdzn/society_dashboard for its intended usage This resource is designed to offload the task of generating CSV files from the game server, thereby reducing server stress. It provides a download link that can be opened in the player's browser.

API Endpoints

Endpoints

  1. GET /api/society/[name]

    • Description: This endpoint retrieves detailed information about a specific society, identified by its name. It queries the database for roles and characters associated with the society, formats the data, and caches it as a CSV file. If the data is already cached, it returns a link to download the CSV file.
  2. GET /api/download/[file]

    • Description: This endpoint allows downloading of a CSV file that contains cached data for a specific society or log. It checks if the file is available and streams it to the client. If the file is expired, it deletes the file from the server.
  3. GET /api/logs/[name]

    • Description: This endpoint fetches logs for a specific society within a given date range. It generates a CSV file with the logs and provides a link to download it. The logs are cached for a limited time.

Usage

  • Fetching Society Details: Use /api/society/[name] to get detailed information about a specific society.
  • Downloading Files: Use /api/download/[file] to download CSV files generated by the system.
  • Fetching Logs: Use /api/logs/[name] to retrieve logs for a society within a specified date range.

Notes

  • Ensure that the name parameter is provided when accessing society-specific endpoints.
  • The from and to parameters in the logs endpoint should be valid timestamps.
  • Cached files are automatically deleted after a certain period to free up server space.

Built With

  • Next

Installation

  1. Clone the repo

  2. Install NPM packages

    npm  install
  3. Run locally

    npm  run  serve