Table of Contents generated with DocToc
- 📖 Description
- User Stories
- 🐛 Known bugs
- Stretch Goals
- 🛠️ Technologies Used/Required
- 🔧 Installation Requirements
- Installing Git
- Installing C#, .NET, dotnet script, & MySQL
- For Mac & Windows Operating Systems
- Clone or Download the Project
- Setting up a Local Database
- MySQL Password Protection & .gitignore
- Import Database in MySQL Workbench
- Import Database with Entity Framework Core
- API Documentation
- Accessing the SwaggerUI
- 📫 Contact
- License
Dotnet API and MVC project, meant to get and post travel reviews of various destinations a user has visited around the world.
| User Stories | |
|---|---|
| 1 | As a user, I want to GET and POST reviews about travel destinations. |
| 2 | As a user, I want to GET reviews by country or city. |
| 3 | As a user, I want to see the most popular travel destinations by number of reviews or by overall rating. |
| 4 | As a user, I want to PUT and DELETE reviews, but only if I wrote them. (Start by requiring a user_name param to match the user_name of the author on the message. You can always try authentication later.) |
| 5 | As a user, I want to look up random destinations just for fun. |
- Home splash page is not fully set up, nor are all our client-side views fully set up or created - although all CRUD routes are in place.
Please report any bugs found here.
- Build out UI more.
- Use SwaggerUI & SwaggerHub more extensively.
- Postman v.7.22.1
- Swashbuckle, v. 5.6.2, for OpenAPI implementations for .NET with Swagger.
- SwaggerUI, v. 5.6.3
- Swagger, For API Documentation, v. 3.0.1
- C# v 7.3
- .NET Core CLI v 2.2
- Identity, ASP.NET MVC Core
- MySQL, MySQL Workbench 8.0
- Entity Framework Core 2.2.6, CRUD, RESTful routing
- dotnet script, REPL
- Razor
- SQL Design Planner
- Visual Code Studio
- Access Terminal in your Finder, and open a new window. Install the package manager, (Homebrew) [https://brew.sh/], on your device by entering this line of code in Terminal:
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)". - Ensure Homebrew packages are run with this line of code:
echo 'export PATH=/usr/local/bin:$PATH' >> ~/.bash_profile. - Once homebrew is installed, install Git, a version control system for code writers, with this line of code
brew install git.
- Open a new Command Prompt window by typing "Cmd" in your computer's search bar.
- Determine whether you have 32-bit or 64-bit Windows by following these (instructions)[https://support.microsoft.com/en-us/help/13443/windows-which-version-am-i-running].
- Go to (Git Bash)[https://gitforwindows.org/], click on the "Download" button, and download the corresponding exe file from the Git for Windows site.
- Follow the instructions in the set up menu.
- Install C# and .Net according to your operating system below.
- Download this .NET Core SDK (Software Development Kit)[https://dotnet.microsoft.com/download/thank-you/dotnet-sdk-2.2.106-macos-x64-installer]. Clicking this link will prompt a .pkg file download from Microsoft.
- Open the .pkg file. This will launch an installer which will walk you through installation steps. Use the default settings the installer suggests.
- Confirm the installation is successful by opening your terminal and running the command $ dotnet --version, which should return something like:
2.2.105.
- Download either the 64-bit .NET Core SDK (Software Development Kit)[https://dotnet.microsoft.com/download/thank-you/dotnet-sdk-2.2.203-windows-x64-installer]. Clicking these links will prompt an .exe file download from Microsoft.
- Open the file and follow the steps provided by the installer for your OS.
- Confirm the installation is successful by opening a new Windows PowerShell window and running the command dotnet --version. You should see something a response like this:
2.2.105.
- Install dotnet script with the following terminal command
dotnet tool install -g dotnet-script.
- Once you have Git installed on your computer, go to this GitHub repository.
- Click the Green 'Code' button.
- Copy the HTTPS link, and open a Terminal or CMD on your local system.
- In the Terminal/CMD, navigate to your Desktop with the command
cd Desktop. - Clone this application onto your local Terminal or CMD with the following command:
git clone https://github.com/dani-t-codes/TravelAPI.Solution.git. - Navigate to the project from your Terminal/Cmd with the command
cd TravelAPI.Solution.
- Alternatively, click the Green 'Code' button from the GitHub repository listed above.
- Select the "Download Zip" from the dropdown options.
- Open/unzip the file that has been downloaded to your local system.
- Open VSCode, or another code editor of your choice, and navigate to the unzipped file folder from File>Open...>TravelAPI.Solution to view the project.
When the project is opened on your local machine...
dotnet restoreto install packages listed in project's boilerplate.dotnet buildwill get bin/ and obj/ folders downloaded.dotnet runwill run the application.
(Ensure you are in the project's root directory, TravelAPI, in your Terminal/CMD before running these commands.)
- Download MySQL Server.
- (Note: If you need additional assistance setting up MySQL, visit their site for further instructions.
- Download MySQL Workbench.
- Run
dotnet ef migrations add Initial--> If there is an error stating "Unable to resolve project", this means the command wasn't run in the correct directory. - Entity creates three files in the Migrations directory.
- Run the following command:
dotnet ef database update.
- Create a file in the root directory of the project called "appsettings.json". Add the following snippet of code to the appsettings.json file:
{
"ConnectionStrings": {
"DefaultConnection": "Server=localhost;Port=3306;database=danielle_thompson_bakery;uid=root;pwd=YOUR-PASSWORD-HERE;"
}
}
-
Where you see "YOUR-PASSWORD-HERE" is where you put the password you created for your MySQL server. Your server name and port might vary depending on your local system. Check MySQL Workbench Connections to determine if the local host and port number match and adjust as needed.
-
If doing any editing or adding to the project, create a .gitignore file and add the following files & folders to it:
- obj/
- bin/
- .vscode/
- .DS_Store
- appsettings.json
- Open MySQL Workbench and a Terminal/CMD. Run the command line
mysql -uroot-p[YOUR-PASSWORD]with your password in the proper place to open a server. - From the top navigation bar, select 'Server' > 'Data Import'.
- Select the option 'Import from Self-Contained File'.
- Click the '...' button to navigate to the project file folder TravelAPI and select danielle_thompson_travel.sql.
- Set 'Default Target Schema' or create new schema.
- Select the schema objects you would like to import
- To finalize, click 'Start Import'.
- From your Terminal/CMD, navigate to the root directory of the project:
cd Desktop/TravelAPI.Solution/TravelAPI. - Run the command
dotnet ef database updateto create the database on your local system. - If any updates to the database are needed with code changes, run
dotnet ef migrations add <NewMigrationNameHere>, thendotnet ef database updateto complete the update.
Feel free to explore the API endpoints in Postman.
Base URL: http://localhost:5004
Launch the project from the TravelAPI project folder by typing dotnet run into the terminal. Input http://localhost:5004/swagger to view and interact with the Swashbuckle SwaggerUI.

