/falcon_anime

anime API server and Nextjs client

Primary LanguageJavaScript

Caution

Project is abandoned

Important

new Project is underway with TypeScript and React

falcon_anime

anime API server and Nextjs client

💻 Installation

.env

  1. .env for server .
    cd server
    make .env and put data in it
    SERVER_URL=mongodb+srv://xxxxxxxxxxxxxxxxxxx
    CLIENT=http://localhost:3000
    SERVER=http://localhost:3001
  2. .env.local for client
    cd client
    make .env.local and put data int it
    NEXT_PUBLIC_SERVER=http://localhost:3001
    NEXT_PUBLIC_CLIENT=http://localhost:3000

Local

  1. Clone the repository and move into the directory.

    git clone https://github.com/falcon71181/falcon_anime
    cd falcon_anime
  2. Install all the dependencies. for server

    cd server

    for client

    cd client
    npm i #or yarn install or pnpm i
  3. Start the server!

    cd server
    npm run dev #or yarn run dev or pnpm run dev

    Now the server should be running on [http://localhost:3001] - (http://localhost:3001)

  4. Start the client!

    cd client
    npm run dev #or yarn run dev or pnpm run dev

    Now the server should be running on [http://localhost:3000] - (http://localhost:3000)

GET Anime Home Page

Endpoint

https://https://falconanime.onrender.com/home

Request sample

const resp = await fetch("https://falconanime.onrender.com/home");
const data = await resp.json();
console.log(data);

Response Schema

{
  genres: ["Action", "Cars", "Adventure", ...],
  latestEpisodeAnimes: [
    {
      id: string,
      name: string,
      poster: string,
      duration: string,
      type: string,
      rating: string,
      episodes: {
        sub: number,
        dub: number,
      }
    },
    {...},
  ],
  spotlightAnimes: [
    {
      id: string,
      name: string,
      jname: string,
      poster: string,
      description: string,
      rank: number,
      otherInfo: string[],
      episodes: {
        sub: number,
        dub: number,
      },
    },
    {...},
  ],
  top10Animes: {
    today: [
      {
        episodes: {
          sub: number,
          dub: number,
        },
        id: string,
        name: string,
        poster: string,
        rank: number
      },
      {...},
    ],
    month: [...],
    week: [...]
  },
  topAiringAnimes: [
    {
      id: string,
      name: string,
      jname: string,
      poster: string,
    },
    {...},
  ],
  topUpcomingAnimes: [
    {
      id: string,
      name: string,
      poster: string,
      duration: string,
      type: string,
      rating: string,
      episodes: {
        sub: number,
        dub: number,
      }
    },
    {...},
  ],
  trendingAnimes: [
    {
      id: string,
      name: string,
      poster: string,
      rank: number,
    },
    {...},
  ],
}

GET Anime About Info

Endpoint

https://falconanime.onrender.com/anime/:id

Query Parameters

Parameter Type Description Required? Default
id string The unique anime id (in kebab case). Yes --

Request sample

const resp = await fetch(
  "https://falconanime.onrender.com/anime/jujutsu-kaisen-2nd-season-18413"
);
const data = await res.json();
console.log(data);

Response Schema

{
  anime: [
    info: {
      id: string,
      name: string,
      poster: string,
      description: string,
      stats: {
        rating: string,
        quality: string,
        episodes: {
          sub: number,
          dub: number
        },
        type: string,
        duration: string
      }
    }
    moreInfo: {
      aired: string,
      genres: ["Action", "Mystery", ...],
      status: string,
      studios: string,
      duration: string
      ...
    }
  ],
  mostPopularAnimes: [
    {
      episodes: {
        sub: number,
        dub: number,
      },
      id: string,
      jname: string,
      name: string,
      poster: string,
      type: string
    },
    {...},
  ],
  recommendedAnimes: [
    {
      id: string,
      name: string,
      poster: string,
      duration: string,
      type: string,
      rating: string,
      episodes: {
        sub: number,
        dub: number,
      }
    },
    {...},
  ],
  relatedAnimes: [
    {
      id: string,
      name: string,
      poster: string,
      duration: string,
      type: string,
      rating: string,
      episodes: {
        sub: number,
        dub: number,
      }
    },
    {...},
  ],
  seasons: [
    {
      id: string,
      name: string,
      title: string,
      poster: string,
      isCurrent: boolean
    },
    {...}
  ]
}

GET Search Results

Endpoint

https://falconanime.onrender.com/anime/search?q={query}&page={page}

Query Parameters

Parameter Type Description Required? Default
q string The search query, i.e. the title of the item you are looking for. Yes --
page number The page number of the result. No 1

Request sample

const resp = await fetch(
  "https://falconanime.onrender.com/anime/search?q=titan&page=1"
);
const data = await resp.json();
console.log(data);

Response Schema

{
  animes: [
    {
      id: string,
      name: string,
      poster: string,
      duration: string,
      type: string,
      rating: string,
      episodes: {
        sub: number,
        dub: number,
      }
    },
    {...},
  ],
  mostPopularAnimes: [
    {
      episodes: {
        sub: number,
        dub: number,
      },
      id: string,
      jname: string,
      name: string,
      poster: string,
      type: string
    },
    {...},
  ],
  currentPage: 1,
  totalPages: 1,
  hasNextPage: false
}