Skip to content

Latest commit

 

History

History
102 lines (85 loc) · 3.66 KB

README.md

File metadata and controls

102 lines (85 loc) · 3.66 KB

Blind Cat Rescue

This is our 13th week project for Epicodus that covers the basics of creating an API.

By Jesse White

👨‍💻 Technologies Used

  • 🆒 C#
  • 🥅 .NET
  • 💽 MySql
  • 🎞 Entity Framework
  • 🕺 Swagger

📜 Description

Blind Cat Rescue takes in all types of animals, but has a soft spot for blind cats. Use this API to access their inventory of current adoptable animals.

🏗 Setup and Use

🏫 Prerequisites

📥 Installation

  1. Clone the repository: $ git clone {https://github.com/JesseDWhite/AnimalShelter.Solution}
  2. Navigate to the {AnimalShelter.Solution} directory on your computer
  3. Open with your preferred text editor to view the code base
  4. To setup a SQL database using MySQL:
    • Create an appsettings.json file in the {AnimalShelter} directory
    • Copy the text box below and paste into the appsettings.json file, replacing <password> with your MySQL password:
         "Logging": {
          "LogLevel": {
            "Default": "Warning",
            "System": "Information",
            "Microsoft": "Information"
          }
       },
      {
         "ConnectionStrings": {
            "DefaultConnection": "Server=localhost;Port=3306;database=jesse_white;uid=root;pwd=<password>;"
          }
      }
    
    • Open your terminal and run the command: mysql -uroot -p<mysql_password> (replace <mysql_password> with your MySQL password) and select the enter key to launch MySQL servers
  5. To run the console app:
  • Navigate to {AnimalShelter.Solution/AnimalShelter} in your command line
    • Run the commands:
      • dotnet restore to restore the dependencies that are listed in {AnimalShelter.csproj}
      • dotnet ef migrations add Initial and dotnet ef database update
    • Finally, run the command dotnet run to run the project!
    • Note: dotnet run also restores and builds the project, so you can use this single command to start the console app
  1. Visit the application via web browser at: http://localhost:5004/

📑 Documentation and Routes

🕺 Swagger

To access the Swagger Documentation for API calls for GET, PUT, and POST please see below:

  • Run the application within {AnimalShelter.Solution/AnimalShelter} in your command line.
  • Once the application is running access the swagger documentation for API calls, go to http://localhost:5004/index.html
    • You can also follow this link while the program is running Swagger.

🖋 Manual Routes

  • GET /api/animals

    • Returns all instances of Animal
  • GET /api/animals/{id}

    • Returns a single instance of Animal
  • POST /api/animals

    • Creates a new instance of Animal
  • PUT /api/animals/{id}

    • Edit an exsisting Animal
  • DELETE /api/animals/{id}

    • Remove an exsisting Animal from the API

Sample Search Query

http://localhost:5004/?animalName=biscuit&animalType=female&age=10

Sample JSON Response

[
  {
    "AnimalId": 1,
    "AnimalName": "Biscuit",
    "AnimalType": "Cat",
    "Gender": "Female",
    "Age": 10,
    "Description": "Loves long walks on the beach... and biscuits."
  }
]

🐛 Known Bugs

  • Get random animal route does not work yet.

⚖ License

MIT © Jesse White 2021

🤳 Contact Information

Jesse White jesse.white6@gmail.com