API version 2

Attention: v1 is more stable

This version is not experimental or in development, but it's not as stable as v1. We recommend you to use v1, but you can still use v2.

Using a database helps us to see more info (like how many times our API is being used) and to have many more answer entries (which right now is 132 answers.)

Not storing all this amount answer objects in database (but, like in v1, storing in static files — see /src/data/answers.ts) could make the perfomance really bad.

v2 changes

Pretty similar to v1, we have the same main endpoint /answers but with some changes.

First, we don't have the /answers/ID sub-route, so you can't select a specific answer object anymore.

Second, the "?number" parameters from the /answers/all sub-route has been removed.

v2 answerObject type

In v2, we have a different object type for answers.

type DBanswerType = {
	id: number;
	answer: string;
	type: answerType;
	count: number;
};

See /src/utils/supabaseClient.ts:14 for more info.

v2 endpoints

With all that, let's go for the examples.

(GET) /answers

{
  "status": "success",
  "data": {
    "answer": {
      "id": 98,
      "answer": "Turn back Now",
      "type": "negative",
      "count": 1
    }
  }
}

As you can see ("id": 98), we have way more answer objects available in v2.

(GET) /answers/all

{
  "status": "success",
  "data": {
    "type": "all",
    "length": 132,
    "answers": [
      {
        "id": 1,
        "answer": "Without a doubt",
        "type": "positive",
        "count": 6,
        "updated_at": "2025-07-23T19:44:12.286792+00:00"
      },
      {...},
	  ...
	]
  }
}

You'll receive all answers in an array

You can also specify "?type | ?t" on this subroute.

(GET) /answers/all?t=positive

Why don't you try it yourself?