Giter Club home page Giter Club logo

restaurantsshopsapi.solution's Introduction

Local Business API

DescriptionRequirementsInstallationContributorsLicense

Description

This program is an API created to allow access to a database of local businesses and their relevant information. It was built with C#/.NET, using Entity Framework to build and integrate with a MySql database. The program has full Index and CRUD functionality, programs accessing the API being capable of accessing an Index of all restaurants and shops in the database as well as of adding a new business to the database, viewing a single business, editing the information of any business in the database, and deleting any business in the database. Additionally, the program integrates pagination capability, allowing programs that access the API to obtain and display paged database information.

Languages & Technologies Used:

Programming Languages, Libraries, & Frameworks

Operating Systems & Programs

Requirements

Installation

  1. Make sure you have installed all required software.
  2. Open your computer's terminal and navigate to the directory in which you would like the program to be stored.
  3. Enter the command git clone https://github.com/taylorsomers/LocalBusinessAPI.Solution in the terminal.
  4. Open the file LocalBusinessAPI.Solution/LocalBusiness/appsettings.json.
  5. In appsettings.json, update the username and password values with your local MySql username and password.
  6. Using the terminal, navigate to the LocalBusinessAPI.Solution/LocalBusiness directory.
  7. Enter the command dotnet restore in the terminal.
  8. Enter the command dotnet build in the terminal.
  9. Enter the command dotnet ef database update in the terminal.
  10. Enter the command dotnet run in the terminal. The program should begin running and be accessible by any other program capable of making API requests.

Database Setup Instructions

CREATE DATABASE IF NOT EXISTS taylor_somers;

USE taylor_somers;

DROP TABLE IF EXISTS __efmigrationshistory;

CREATE TABLE __efmigrationshistory ( MigrationId varchar(95) NOT NULL, ProductVersion varchar(32) NOT NULL, PRIMARY KEY (MigrationId) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

DROP TABLE IF EXISTS restaurants;

CREATE TABLE restaurants ( RestaurantId int NOT NULL AUTO_INCREMENT, RestaurantName longtext, RestaurantAddress longtext, RestaurantType longtext, RestaurantYelpRating longtext, PRIMARY KEY (RestaurantId) ) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

DROP TABLE IF EXISTS shops;

CREATE TABLE shops ( ShopId int NOT NULL AUTO_INCREMENT, ShopName longtext, ShopAddress longtext, ShopType longtext, ShopYelpRating longtext, PRIMARY KEY (ShopId) ) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

API Routing & Testing

HTTP Request

Functionality Request Type HTTP Route
Index GET /api/restaurants
Index GET /api/shops
Create POST /api/restaurants
Create POST /api/shops
Read GET /api/restaurants/{id}
Read GET /api/shops/{id}
Update PUT /api/restaurants/{id}
Update PUT /api/shops/{id}
Delete DELETE api/restaurants/{id}
Delete DELETE api/shops/{id}

Path Parameters

Parameter Type Default Required Description
restaurantname string none false Returns restaurants by queried name.
restaurantaddress string none false Returns restaurants by queried address.
restauranttype string none false Returns restaurants by queried type.
restaurantyelprating string none false Returns restaurants by queried Yelp rating.
shopname string none false Returns shops by queried name.
shopaddress string none false Returns shops by queried address.
shoptype string none false Returns shops by queried type.
shopyelprating string none false Returns shops by queried Yelp rating.

Sample Query & JSON Response

Sample Query Sample JSON Response
localhost:5000/api/restaurants/?restauranttype=barbecue {"restaurantId": 6, "restaurantName": "Tom & Flip's BBQ", "restaurantAddress": "8465 Adams Dr, Greer, SC 29650", "restaurantType": "Barbecue", "restaurantYelpRating": "4 Stars"}, {"restaurantId": 7, "restaurantName": "City of Pigs", "restaurantAddress": "8465 Adams Dr, Greer, SC 29650", "restaurantType": "Barbecue", "restaurantYelpRating": "3 Stars"}

Note on API Pagination

  • The Local Business API returns a default count of 3 restaurants per page and 5 shops per page.
  • To modify the default result count per page, use limit and start query parameters to change the number of results displayed per page.

Known Bugs

Location : Message Situation Resolved (Y/N) Bug Resolution Strategy
Terminal : Unable to create an object of type 'LocalBusinessContext'. Error thrown when attempting Initial migration. Y Add DesignTimeDbContextFactory.cs file to LocalBusiness/Models directory.

Support & Contact Details

  • You are welcome to contact the author via GitHub with any concerns, feedback, possible contributions, questions, or suggestions.

Contributors

License

restaurantsshopsapi.solution's People

Contributors

taylorsomers avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.