Skip to content
This repository has been archived by the owner on Feb 21, 2023. It is now read-only.

thekidnamedkd/TravelApi.Solution

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 

Repository files navigation

Travel API

An exercise to practice building an API, 8.19.20

By Kevin Davis and Taylor Phillips


Description

This was a practice in building our own API. We constructed a Travel_API with locations and information about the specific places. Throughout the project build we were able to implement pagination, tokenization, and some swagger documentation. There is no client side application to this project yet.


Specifications/Example Queries

Example Query:
https://localhost:5000/api/locations/search?continent=australia

https://localhost:5000/api/locations/pages?pageNumber=1&pageSize=3


Software/Installation Requirements

Setup 💻

Copy this url to clone this project to your local system using computer's Command Line terminal: https://github.com/tayphill13/TravelApi.Solution.git

If you wish to edit the code base: Open the project in your code editor; with Bash, this is done by navigating to the project directory cd TravelApi.Solution, then code .

Database Setup/Migration

  • Run MySQL by entering mysql -uroot -pepicodus in the terminal (In this example, 'epicodus' is the password, so if the word password was your password then you'd have msql -uroot -ppassword)

  • If you are using mysql workbench then the database can be generated by importing travel_api.sql located in the TravelApi.Solution directory.

  • This can be found in the MySql Workbench Server menu as Data Import, then choose Import from Self-Contained File. Use the browsing tool to select the travel_api.sql file that is included with the project and finally select Start Import.

MySql gif tutorial)

  • Within the project file, appsettings.json you will need to be sure that the password (pwd) matches the password that you are using for your MySql Workbench.

  • Your appsettings.json file should follow this format:

    }
      "ConnectionStrings": {
          "DefaultConnection": "Server=localhost;Port3306;database=databaseNameHere;uid=YourUserNameHere;pwd=YourPasswordHere;"
        }
    }
    

Alternatively,

  • In your command line terminal, type cd Desktop then navigate to project folder using cd TravelApi.Solution
  • Then navigate to cd TravelApi and type dotnet ef migrations Initial
  • Then type dotnet ef database update
  • You can confirm your the database has been created by going to the Schemas tab in your MySql Workbench and then right click and select Refresh All in the schema window.

Image from Gyazo

Running the program:

  1. In your command line terminal, type cd Desktop then navigate to project folder using cd TravelApi.Solution
  2. To run the program, you'll need navigate to the project folder by entering cd TravelApi, then to compile the code enter: dotnet restore. This will create a compiled application in the bin/ folder. Do not touch the files in the bin/ or obj/ folders, you will not need to and the application will not run as intended.
  3. You can then run the program directly with dotnet run while still within the TravelApi directory.

OpenAPI Documentation:

For further documentation on our API, see our SwaggerUI here http://localhost:5000/swagger/index.html#/


Known Bugs

No known bugs


Support and contact details

Please reach out through my GitHub account.


Technologies Used

Written in: Visual Studio Code

Database Mgmt: MySql Workbench

Using C# and .Net Core

This was completed using MacOS


License

Copyright (c) 2020 Taylor Phillips and Kevin Davis
License: MIT

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 100.0%