Skip to content

This is a web API of a database for national parks in the United States. It was made using C#, .Net 5, MySQL, and Entity. It makes use of Swagger UI to provide documentation for the endpoints.

Notifications You must be signed in to change notification settings

marnionrails/NationalParksApi.Context

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 

Repository files navigation

Web API for US National Parks

Epicodus Code Review: Web APIs in C#/.NET

By Marni Sucher

Table of Contents

  1. Description
  2. Technologies Used
  3. Setup/Installation Requirements
  4. Endpoints
  5. Known Bugs
  6. License
  7. Contact Information

Description

This is a web API of a database for national parks in the United States. It was made using C#, .Net 5, MySQL, and Entity. It makes use of Swagger UI to provide documentation for the endpoints.

Technologies Used

  • C#
  • .NET 5
  • Entity
  • Swagger
  • MySQL
  • Git
  • VS Code

Setup/Installation Requirements

  • If C# and .NET are not installed on your local device, follow the instructions here
  • If MySQL Community Server and MySQL Workbench are not installed on your local device, follow the instructions here
  • Open the terminal on your local machine
  • Clone this repository to your machine $ git clone https://github.com/marnionrails/NationalParksApi.Context
  • Create appsettings.json file:
{
  "ConnectionStrings": {
      "DefaultConnection": "Server=localhost;Port=3306;database=national_parks;uid=root;pwd=<YOUR PASSWORD HERE>;"
  }
}
  • Create local database from migration with dotnet ef database update
  • Compile code by running command $ dotnet build
  • Run server with command $ dotnet run
  • Navigate to desired endpoint as documented below

Endpoints

The Swagger user interface will allow you to "try out" any of the endpoints.

To see Swagger documentation and utilize the feature (while server is running!), click here

GET

  • GETs all National Parks in the database:
    http://localhost:5000/api/nationalparks/parks

  • GETs any National Parks with a name that matches your query:
    http://localhost:5000/api/nationalparks/parks?name=<YOUR QUERY HERE>

  • GETs any National Parks with a region that matches your query:
    http://localhost:5000/api/nationalparks/parks?region=<YOUR QUERY HERE>

  • GETs any National Parks with a state that matches your query:
    http://localhost:5000/api/nationalparks/parks?state=<YOUR QUERY HERE>

  • GETs any National Parks that have a description containing your query:
    http://localhost:5000/api/nationalparks/parks?description=<YOUR QUERY HERE>

  • GETs the National Park with the Id as specified in the request:
    http://localhost:5000/api/nationalparks/parks/{ID}

POST

  • POSTs a new National Park to the API:
    http://localhost:5000/api/nationalparks/parks

DELETE

  • DELETEs the National Park with the Id as specified in the request:
    http://localhost:5000/api/nationalparks/parks/{ID}

PUT

  • PUTs new data into the National Park entry with the Id as specified in the request:
    http://localhost:5000/api/nationalparks/parks/{ID}

Known Bugs

  • None at this time

License

MIT

Copyright (c) 2021 Marni Sucher

Contact Information

Marni Sucher suchermarni@gmail.com

About

This is a web API of a database for national parks in the United States. It was made using C#, .Net 5, MySQL, and Entity. It makes use of Swagger UI to provide documentation for the endpoints.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages