Coder Social home page Coder Social logo

byob's Introduction

Build Your Own Pokémon API


About

Byob is the backend part of this project to support the frontend. It's meant for storing all the Pokemon trainers and the Pokemon teams built using the app.

Tech Stack

  • Node.js
  • Express
  • Knex
  • Tested with Chai and Mocha

Table of Contents


Trainers

  • GET - All Trainers - /api/v1/trainers

Hitting this endpoint will return an array of all trainers.

Example Response
[
  {
    id: 1,
    name: 'Kiel',
    level: '1'
  },
  {
    id: 2,
    name: 'Dennis',
    level: '2'
  }
  ...
]
  • GET - All trainers at a certain level - api/v1/trainers?level=:level

Hitting this enpoint will return an array of trainers at a certain level.

Example Response
[
  {
    id: 1,
    name: 'Kiel',
    level: '1'
  },
  {
    id: 2,
    name: 'Dennis',
    level: '1'
  }
  ...
]
  • GET - Trainer by id - /api/v1/trainers/:id

Hitting this endpoint will return one trainer.

Example Response
{
  id: 2,
  name: 'Dennis',
  level: '2'
}
  • DELETE - Trainer by id - api/v1/trainers/:id
Example endpoint
api/v1/trainers/1
  • PATCH - Edit trainer name - api/v1/trainers/:id

Example endpoint

/api/v1/trainers/43
Example request object
{
  name: 'Dennis'
}
  • PATCH - Edit trainer level - api/v1/trainer-levels/:id

Example endpoint

/api/v1/trainer-levels/43
Example request object
{
  level: 5
}
  • POST - Add new trainer - api/v1/trainers
Example request object
{
  name: 'Dennis',
  level: 5
}

Pokémon

  • GET - All Pokémon - /api/v1/pokemon

Hitting this endpoint will return an array of all the Pokémon.

Example Response
[
  {
    id: 12,
    trainer_id: 1,
    pokemon_one: [imgUrl],
    pokemon_two: [imgUrl],
    pokemon_three: [imgUrl],
    pokemon_four: [imgUrl],
    pokemon_five: [imgUrl]
  },
  {
    id: 35,
    trainer_id: 2,
    pokemon_one: [imgUrl],
    pokemon_two: [imgUrl],
    pokemon_three: [imgUrl],
    pokemon_four: [imgUrl],
    pokemon_five: [imgUrl]
  }
  ...
]
  • GET - Pokémon by id - /api/v1/pokemon/:id

Hitting this endpoint will return one Pokémon.

Example Response
{
  id: 35,
  trainer_id: 2,
  pokemon_one: [imgUrl],
  pokemon_two: [imgUrl],
  pokemon_three: [imgUrl],
  pokemon_four: [imgUrl],
  pokemon_five: [imgUrl]
}
  • DELETE - Pokémon by id - api/v1/pokemon/:id
Example endpoint
api/v1/pokemon/1
  • POST - Add new Pokémon - api/v1/pokemon
Example request object
{
  trainer_id: 2,
  pokemon_one: [imgUrl],
  pokemon_two: [imgUrl],
  pokemon_three: [imgUrl],
  pokemon_four: [imgUrl],
  pokemon_five: [imgUrl]
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.