This API allows users to GET, POST, PUT, and DELETE animals of the cretaceous period.
- A user is able to GET, POST, PUT, and DELETE animals.
- A user is able to view details for a specific animal, based on AnimalId.
- A user is able to GET animals by species, gender, and/or name.
- '/animals'
- GET request
- returns list of all animals matching search parameters gender, species, and/or name, or all animals if no search parameters are used.
- '/animals'
- POST request, requires body of animal object formatted in JSON
- returns nothing, but adds an entry of an animal to the
cretaceous_park
database tableanimals
- '/animals/{id}'
- GET request
- returns details for a specific animal
- '/animals/{id}'
- PUT request, requires a body of an animal object formatted in JSON
- returns nothing, but updates an existing entry in the
animals
table of thecretaceous_park
database
- '/animals/{id}'
- DELETE request
- returns nothing, but removes an existing entry from the
animals
table of thecretaceous_park
database
- Click here to download a .NET Core SDK from Microsoft Corp.
- Open the file (this will launch an installer which will walk you through installation steps. Use the default settings the installer suggests.)
- Click here to download the 64-bit .NET Core SDK from Microsoft Corp.
- Open the .exe file and follow the steps provided by the installer for your OS.
Enter the command dotnet tool install -g dotnet-script
in Terminal (macOS) or PowerShell (Windows).
Download the MySQL Community Server DMG File here. Follow along with the installer until you reach the configuration page. Once you've reached Configuration, set the following options (or user default if not specified):
- use legacy password encryption
- set password (and change the password field in appsettings.json file of this repository to match your password)
- click finish
- open Terminal and enter the command
echo 'export PATH="/usr/local/mysql/bin:$PATH"' >> ~/.bash_profile
if using Git Bash. - Verify MySQL installation by opening Terminal and entering the command
mysql -uroot -p{your password here, omitted brackets}
. If you gain access to the MySQL command line, installation is complete. An error (e.g., -bash: mysql: command not found) indicates something went wrong.
Download the MySQL Web Installer here and follow along with the installer. Click "Yes" if prompted to update, and accept license terms.
- Choose Custom setup type
- When prompted to Select Products and Features, choose the following: MySQL Server (Will be under MySQL Servers) and MySQL Workbench (Will be under Applications)
- Select Next, then Execute. Wait for download and installation (can take a few minutes)
- Advance through Configuration as follows:
- High Availability set to Standalone.
- Defaults are OK under Type and Networking.
- Authentication Method set to Use Legacy Authentication Method.
- Set password to epicodus. You can use your own if you want but epicodus will be assumed in the lessons.
- Unselect Configure MySQL Server as a Windows Service.
- Complete installation process
Add the MySQL environment variable to the System PATH. Instructions for Windows 10:
- Open the Control Panel and visit System > Advanced System Settings > Environment Variables...
- Select PATH..., click Edit..., then Add.
- Add the exact location of your MySQL installation and click OK. (This location is likely C:\Program Files\MySQL\MySQL Server 8.0\bin, but may differ depending on your specific installation.)
- Verify installation by opening Windows PowerShell and entering the command
mysql -uroot -p{your password here, omitted brackets}
. It's working correctly if you gain access to the MySQL command line. Exit MySQL by entering the commandexit
.
Enter the following commands in Terminal (macOS) or PowerShell (Windows):
cd desktop
git clone
followed by the URL to this repositorycd CretaceousPark.Solution/CretaceousPark
Confirm that you have navigated to the CretaceousPark directory (e.g., by entering the command pwd
in Terminal).
Recreate the cretaceous_park
database using the following commands (in Terminal on macOS or PowerShell on Windows) at the root of the CretaceousPark directory:
dotnet restore
dotnet build
dotnet ef database update
Run this application by entering the following command in Terminal (macOS) or PowerShell (Windows) at the root of the CretaceousPark directory:
dotnet run
ordotnet watch run
- With the API running, open the Swagger UI to view and test the different routes of this API!
To view/edit the source code of this application, open the contents of the CretaceousPark.Solution directory in a text editor or IDE of your choice (e.g., to open all contents of the directory in Visual Studio Code on macOS, enter the command code .
in Terminal at the root of the CretaceousPark.Solution directory).
- Git 2.23.0
- C# language
- .NET Core 2.2.106
- dotnet script 0.50.1
- Visual Studio Code 1.43.1
- Model-View-Controller(MVC) framework
- MySQL 8.0.15
- MySQL Workbench 8.0.15
- Entity Framework Core 2.2.4
- Language-Integrated Query (LINQ)
- ASP.NET Razor
- GitBash
- Swagger 2.0 documentation (swagger.json)
- NSwag
Licensed under the MIT license.
© 2020 - Michelle Morin, Joseph Wangemann, Jonathan Carlos, Kristina Hengster Tintor