By Daniel Adeyemi
This is a custom API (versions 1.0 and 1.1) to lookup national and local parks by name, location etc .
- ASP .NET Core : You can check if you have .NET Core by running
dotnet --version
in the command line. If you do not have .NET Core please find more information and download here - MySQL : You can download MySQL here and MySQL Workbench here
- Go to my GitHub repository, using following URL.
- At the top of the repository, click
and copy the URL.
- Open Terminal or GitBash and input the command:
git clone https://github.com/DanielAdeyemi/ParksLookup.Solution.git
- To view the code, open the copied directory with Visual Studio Code or your preferred text editor by inputing the command
code .
in your terminal.
- After you have the project on your computer you will need to create a file in the root directory of the project called "appsettings.json".
- Add the following snippet of code to the appsettings.json file:
{
"Logging": {
"LogLevel": {
"Default": "Warning",
"Microsoft": "Information",
"System": "Information"
}
},
"AllowedHosts": "*",
"ConnectionStrings": {
"DefaultConnection": "Server=localhost;Port=3306;database=daniel_adeyemi;uid=[YOUR-ACCOUNT-NAME];pwd=[YOUR-PASSWORD];"
}
}
*Please note you will need to replace YOUR-PASSWORD-HERE
with the password you created for your MySQL server.
*You may also need to update uid
, port
, or database
name depending on your configurations.
- In the command line run
cd Desktop/ParksLookup.Solution/ParksLookup
to navigate to the "ParksLookup" folder. - Next, run
dotnet ef database update
to generate the database. You can confirm the database was created by checking MySQL workbench.
dotnet ef migrations add <MigrationName>
In order to explore the endpoints of this API, we suggest that you use Postman. Postman will allow you to make GET, POST, PUT, and DELETE requests with the ParksLookupApi
.
Base URL: http://localhost:5000
GET /api/parks
GET /api/parks/{id}
POST /api/parks
PUT /api/parks/{id}
DELETE /api/parks/{id}
Parameter | Type | Default | Required | Description |
---|---|---|---|---|
ParkName | string | none | false | Return matches by name. |
Location | string | none | false | Return matches by location (check note below for comma separated locations such Portland, OR ). |
National | bool | none | false | Return all parks marked as National |
Local | bool | none | false | Return all parks marked as Local |
Portland, OR
use following path:
?location=portland%2C%20or
http://localhost:5000/api/parks/?location=portland%2C%20or&local=true
[
{
"parkId": 1,
"parkName": "Buike",
"parkLocation": "Portland, OR",
"national": false,
"local": true
}
]
Version 1.0 of ParksLookup API was setup as default version in Startup.cs
file. API also support 1.1 version. For additional information check table below:
Version | Default | Description | query |
---|---|---|---|
1.0 | true | looks for parks by name, locations, national/state affilation. | http://localhost:5000/api/parks/ |
1.1 | false | get route will display only national parks by default | http://localhost:5000/api/parks/?v=1.1 |
- C# 9
- .NET Core v5.0
- RESTful Routing, CRUD
- MySQL MySQL Workbench
- Entity Framework Core
- MVC.Versioning 5.0.0
- Postman
- Git and GitHub
To view functionality you need to run dotnet run
command from ParksLookup folder. After that you will see http://localhost:5000 and can need to open Postman and enter the API queries described above (see API Documentation for more details)
No bugs as of 4/2/2021
- build views
- add more features(such as login etc) to make it more useful in real world.