A simple API that caches and allows you to fetch data from the [Non-Listworthy Extreme Demons spreadsheet](https://docs.google.com/spreadsheets/d/1YxUE2kkvhT2E6AjnkvTf-o8iu_shSLbuFkEFcZOvieA/edit) (and [Insane Demon Spreadsheet](https://docs.google.com/spreadsheets/d/15ehtAIpCR8s04qIb8zij9sTpUdGJbmAE_LDcfVA3tcU/edit)!) running on `https://nlw.oat.zone/`. Originally made for the [NLW Integration](https://geode-sdk.org/mods/oatmealine.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 [`NLWLevel`](#nlwlevel--level)s.
Fetches the IDS list as a JSON, including levels of type `type`. `type` can be `regular`, `platformer` or `all` and defaults to `regular`. **Experimental.**
-`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](https://theoephraim.github.io/node-google-spreadsheet/#/guides/authentication?id=api-key).
2. Install, either with NPM or Nix:
1. With NPM, run:
```sh
npm install
```
Then, you can start it with:
```sh
API_KEY=... node index.js
```
**However**, take note of the [environment variables](#environment-variables) available to use.
2. Use Nix to either just plainly run it:
```sh
API_KEY=... nix run git+https://git.oat.zone/oat/nlw-api
Afterwards, you can use it as a regular NixOS service:
```nix
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](https://theoephraim.github.io/node-google-spreadsheet/#/guides/authentication?id=api-key) to see how to get one hassle-free