Go to file
Jill d48742208d
hopefully fix oob crash
2024-04-19 19:44:57 +03:00
.gitignore ids!!! yippeeeeeee 2024-02-16 16:15:51 +03:00
README.md add ids platformer 2024-02-29 14:01:21 +03:00
flake.lock initial commit 2024-02-03 18:41:58 +03:00
flake.nix update flake to use CACHE_DIR 2024-02-16 17:01:57 +03:00
ids.js hopefully fix oob crash 2024-04-19 19:44:57 +03:00
index.js oops 2024-02-29 14:03:23 +03:00
nlw.js hopefully fix oob crash 2024-04-19 19:44:57 +03:00
package-lock.json ids!!! yippeeeeeee 2024-02-16 16:15:51 +03:00
package.json ids!!! yippeeeeeee 2024-02-16 16:15:51 +03:00
persistance.js persistently call sheets api to try and fix ratelimiting issues 2024-02-29 13:39:58 +03:00

README.md

nlw-api

A simple API that caches and allows you to fetch data from the Non-Listworthy Extreme Demons spreadsheet (and Insane Demon Spreadsheet!) running on https://nlw.oat.zone/. Originally made for the NLW Integration Geode mod, but free for anyone to use.

Documentation

Endpoints

/list?type={type}

Fetches the entire list as a JSON, including levels of type type. type can be regular, pending, platformer or all and defaults to regular.

Returns: An array of NLWLevels.

/ids?type={type}

Fetches the IDS list as a JSON, including levels of type type. type can be regular, platformer or all and defaults to regular. Experimental.

Returns: An array of IDSLevels.

Objects

Level

Represents a generic level.

  • sheetIndex: The row index of the level on the associated spreadsheet. 0-indexed.
  • id: The ID of the level, manifested from the sheet using dark magic. Can be undefined very rarely.
  • name: The name of the level. Standardized to the in-game level name.
  • creator: The creator(s) of the level, as listed on the sheet.
  • description: Descriptions and notes as listed on the sheet.

NLWLevel : Level

Represents an NLW level.

  • tier: "Fuck", "Beginner", "Easy", "Medium", "Hard", "Very Hard", "Insane", "Extreme", "Remorseless", "Relentless" or "Terrifying".
  • skillset: Level skillset, as listed on the sheet.
  • enjoyment: Level enjoyment sampled from EDEL as a number, or null.
  • broken: If the level is broken in 2.2. "no", "slightly", "very", "absolutely destroyed" or rarely null if unknown.

IDSLevel: Level

Represents an IDS level.

  • tier: "Fuck", "Beginner", "Easy", "Medium", "Hard", "Very Hard", "Insane" or "Extreme".
  • skillset: Level skillset, as listed on the sheet.
  • broken: If the level is broken in 2.2. "no", "yes", or rarely null if unknown.

Self-hosting

You can self-host the API yourself, if you so wish! Here's the rough steps:

  1. Grab yourself a Google Sheets API key. This may sound extremely intimidating, but you can create a read-only Sheets API key with not much hassle with this guide.
  2. Install, either with NPM or Nix:
    1. With NPM, run:
      npm install
      
      Then, you can start it with:
      API_KEY=... node index.js
      
      However, take note of the environment variables available to use.
    2. Use Nix to either just plainly run it:
      API_KEY=... nix run git+https://git.oat.zone/oat/nlw-api
      
      Or import it into your system flake like so:
      nlw-api.url = "git+https://git.oat.zone/oat/nlw-api";
      # in your `nixosConfiguration`:
      imports = [
        inputs.nlw-api.nixosModules.nlw-api
      ];
      
      Afterwards, you can use it as a regular NixOS service:
      services.nlw-api = {
        enable = true;
        domain = "nlw.oat.zone";
        apiKey = builtins.readFile /etc/sheets-api-key;
        port = 1995;
      };
      
  3. You're done! It will take a while to fetch every level and their IDs initially, but in time you will have yourself the caches set up and the server up and running.

Environment variables

You can pass these into the server as config (an .env file will not work):

  • API_KEY: A Google API key - see this guide to see how to get one hassle-free
  • PORT: The HTTP port to host the server on
  • CACHE_DIR: The directory to store cached data in, defaults to ./cache/