This is a custom built RESTful API built using .NET Core with Swagger Documentation to manage, and display restaurants and shops in the database. You can do all CRUD functionality including create, update, delete, get one, get all, for both restaurants and shops.
By Austin Schrader, 1/22/2020
- Clone or Download this repository
- Navigate to the folder where you downloaded or cloned this repository
- Now open your terminal and navigate to friday-business-api > BusinessApi
- Type in
dotnet restore
to download necessary packages - Modify the file titled appsettings.json and input your MySQL password as the value for "pwd"
- Import the MySQL database
- Then type in
dotnet run
to run the application - Congratulations, this is the program!
- Swagger documentation is a fantastic tool that allows you to generate API documentation.
- To access Swagger, you actually don't need to do any additional setup or installation.
- Immediately after finishing "Project Setup" instructions, when the application is running, navigate to http://localhost:5000/swagger/index.html
- You can click on either "Shops" or "Restaurants" to be shown the CRUD routes that the API supports.
- To add a Shop, click the Shops button
- Then click POST for /api/Shops
- Finally all Shops, click on the "Get" button and then
Home URL of the API: http:localhost:5000/
The structure of the API requests are as follows:
Description | URL | Method | Body | Return Value |
---|---|---|---|---|
Get all Restaurants | http://localhost:5000/api/restaurants | GET | - | |
Post a Restaurant | http://localhost:5000/api/restaurants | POST | - | |
Get a Restaurant | http://localhost:5000/api/restaurants/{id} | GET | - | |
Put a Restaurant | http://localhost:5000/api/restaurants/{id} | PUT | - | |
Delete a Restaurant | http://localhost:5000/ape/restaurants/{id} | DELETE | - | - |
Description | URL | Method | Body | Return Value |
---|---|---|---|---|
Get all Shops | http://localhost:5000/api/shops | GET | - | |
Post a Shop | http://localhost:5000/api/shops | POST | - | |
Get a Shop | http://localhost:5000/api/shops/{id} | GET | - | |
Put a Shop | http://localhost:5000/api/shops/{id} | PUT | - | |
Delete a Shop | http://localhost:5000/api/shops/{id} | DELETE | - | - |
- Open MySQL Workbench & enter in your MySQL password
- Navigate to Administration
- Click Data Import/Restore
- Click the 'Import from Self-Contained File' radio button
- Click the
...
button and navigate to the Downloaded/Cloned repository and double click on the SQL database - Select Dump Data & Structure
- Start Import
- Navigate to the project directory, in this case Shop.Solution > Shop
- Run
dotnet ef database update
to generate the MySQL Database using the migration - If you want to update the structure of the DB, first modify the models, then run:
dotnet ef migrations add {MIGRATIONNAMEHERE}
- Finally, run the
dotnet ef database update
to apply the migration to your MySQL database
- Download this repository by clicking the "Code" button and then copy the url
- Open a terminal and navigate to where you want the repository cloned to
- Type in
git clone https://github.com/austinschrader/friday-business-api
- Congratulations, you cloned the repository.
- Download this repository by clicking the "Code" button and then "Download Zip"
- Right click the downloaded file and "Unzip"
- Double click on the file that was just unzipped
- Congratulations, you downloaded the repository.
At this time, there are no known bugs. If you see spot a bug feel free to make a pull request.
- C#
- .NET Core 2.2
- MySQL & MySQL Workbench
- Object Oriented Programming
- Entity Framework
- Git
- Gitbash
- Github
- Identity
- Swagger Documentation
- API
- NSwag
- Postman
This repository is licensed under the MIT license.
Copyright (c) 2020 by Austin Schrader