Skip to content

It is a cat API seeded with a list of cats and shelters from Alberta, Canada.

Notifications You must be signed in to change notification settings

aramatsolrac/meowdopt-API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

meowdopt API

  • It is a cat API seeded with a list of cats and shelters from Alberta, Canada.

Table of contents

Overview

  • The url for the API is https://meowdopt-api.herokuapp.com/
    • Note: If it does not open at the first try, give it a minute because free heroku dyno could be sleeping.

Technologies

html5 css3 javascript nodejs express knex mysql

Routes

Shelters

GET /shelters

  • Returns an array of shelters objects

Example response body

[
  {
    "id": "1",
    "name": "Pawsitive Foundation",
    "address": "503 Broadway",
    "city": "Calgary",
    "email": "[email protected]"
  },
  {
    "id": "2",
    "name": "Meow Shelter",
    "address": "33 Pearl Street SW",
    "city": "Calgary",
    "email": "[email protected]"
  }
]

GET /shelters/:id

  • Returns a detailed object of a single shelter

Example response body

[
  {
    "id": "1",
    "name": "Pawsitive Foundation",
    "address": "503 Broadway",
    "city": "Calgary",
    "email": "[email protected]"
  }
]

GET /shelters/:id/cats

  • Returns a list of cats of a specific shelter

Example response body

[
  {
    "id": 11,
    "name": "Robson",
    "gender": "Male",
    "age": "Senior",
    "description": "This wise, loving senior gentleman was rescued in a small town just outside Calgary and his owners were not able to be located. So he is starting over. After a full health check, a bit of a shave to remove some matts, he is healthy and would like to meet his match as soon as possible. He is not a fan of other cats and would prefer to be the only King in your life.",
    "image": "/images/cat0.jpeg",
    "shelter_id": 1
  },
  {
    "id": 1717,
    "name": "Edu",
    "gender": "Male",
    "age": "Adult",
    "description": "I love to play, and my favorite game is chasing balls. I'm affectionate and I don't like being hugged, but if I have a lap available, I take the opportunity to take a nap and cuddle.",
    "image": "/images/cat16.jpeg",
    "shelter_id": 1
  }
]
Cats

GET /cats

  • Returns an array of cat objects

Example response body

[
  {
    "id": "11",
    "shelter_id": "1",
    "name": "Robson",
    "image": "/images/cat0.jpeg",
    "gender": "Male",
    "description": "This wise, loving senior gentleman was rescued in a small town just outside Calgary and his owners were not able to be located. So he is starting over. After a full health check, a bit of a shave to remove some matts, he is healthy and would like to meet his match as soon as possible. He is not a fan of other cats and would prefer to be the only King in your life.",
    "age": "Senior"
  },
  {
    "id": "22",
    "shelter_id": "2",
    "name": "Pedro",
    "image": "/images/cat1.jpeg",
    "gender": "Male",
    "description": "I am a big and sometimes sassy guy. I prefer a quieter place of residence without other pets or kids. I have a weird love/hate relationship with bags. When you handle one it startles me but I like to try to climb inside of them. Despite being kind of picky and oddly not a big fan of Temptations treats, I have a healthy appetite. I do play with toys with you and alone but not for long. Once I settle in with you I will try to take your spot on the couch or at worst lean on you while sitting next to you.",
    "age": "Adult"
  }
]

GET /cats/:id

  • Returns a detailed object of a single cats

Example response body

{
  "id": "44",
  "shelter_id": "4",
  "name": "Lucas",
  "image": "/images/cat3.jpeg",
  "gender": "Male",
  "description": "This sweet but shy boy was brought in from a rural property. He acts a little unsure when he first meets someone, but once he realizes you want to love him he is soon pushing into your hand for attention. He is good with other cats but does not have dog experience. This attractive tuxedo with a black smooch beside his nose needs a forever human.",
  "age": "Kitty"
}

POST /cats/:id/like

  • Add one like for a specific cat

Example response body

{
  "isLiked": true,
  "user_id": "1",
  "cat_id": "22"
}

DELETE /cats/:id/remove-like

  • Deletes the given like;

Example response body

{
  "user_id": "1",
  "cat_id": "22"
}
Requests

GET /requests

  • Returns an array of requests objects

Example response body

[
  {
    "id": 1,
    "name": "Lucas",
    "email": "[email protected]",
    "status": "Received",
    "cat_id": 22,
    "user_id": 1
  },
  {
    "id": 2,
    "name": "Lucas",
    "email": "[email protected]",
    "status": "Received",
    "cat_id": 1010,
    "user_id": 1
  }
]

POST /requests/:id/form

  • Post a new cat request

Example parameters

{
  "user_id": 1,
  "cat_id": 1010,
  "name": "Lucas",
  "email": "[email protected]"
}

DELETE /requests/:id/delete

  • Delete a sent request by a user

Example parameters

{
  "id": 1
}
Users

GET /users

  • Returns an array of users objects

Example response body

[
  {
    "id": 13,
    "name": "Olivia",
    "username": "olivia",
    "email": "[email protected]",
    "password": "$2b$10$ATmle6b.W3MCz7/qcnO/7.iFj02SkPxLPKqPo9dhswPMdi09F8DYO"
  },
  {
    "id": 14,
    "name": "Maria",
    "username": "maria",
    "email": "[email protected]",
    "password": "$2b$10$YZNtJS7NQCC9Ru8zh8FW3eKI9.cFLCdCNxgXcbtX6DhzRo0fVezVe"
  }
]

GET /users/:id

  • Returns an object of a single user

Example response body

{
  "id": 13,
  "name": "Olivia",
  "username": "olivia",
  "email": "[email protected]",
  "password": "$2b$10$ATmle6b.W3MCz7/qcnO/7.iFj02SkPxLPKqPo9dhswPMdi09F8DYO"
}

GET /users/:id/favorites

  • Returns a list of cats liked by a specific user

Example response body

[
  {
    "cat_name": "Robson",
    "image": "/images/cat0.jpeg",
    "user_name": "Olivia",
    "id": 57,
    "isLiked": 1,
    "cat_id": 11,
    "user_id": 13
  }
]

GET /users/:id/requests

  • Return a list of requests sent by a specific user

Example response body

[
  {
    "cat_name": "Robson",
    "image": "/images/cat0.jpeg",
    "id": 6,
    "name": "Olivia",
    "email": "[email protected]",
    "status": "Received",
    "cat_id": 11,
    "user_id": 13
  }
]

POST /users/signup

  • Create a new login

Example parameters

{
  "name": "Test",
  "username": "test",
  "email": "[email protected]",
  "password": "test"
}
Login

POST /login

  • Verify if the user login exist and sign in

Example parameters

{
  "message": "Success"
}

Installing

  • Download this Repository or clone it: git clone [email protected]:aramatsolrac/meowdopt-API.git
  • cd into the new folder and type npm install
  • To run the project type: npm start

Author

About

It is a cat API seeded with a list of cats and shelters from Alberta, Canada.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages