GithubHelp home page GithubHelp logo

eluckie / arresteddevelopment.solution Goto Github PK

View Code? Open in Web Editor NEW

This project forked from bbakshev/arresteddevelopmentclient.solution

0.0 0.0 0.0 892 KB

C# and .NET (classwork) - practice building an MVC webpage application that interacts with our custom-built API

JavaScript 0.61% C# 66.25% CSS 12.50% HTML 20.65%

arresteddevelopment.solution's Introduction

Arrested Development Quotes

By: Brishna Bakshev, Kai Clausen, Mike Donovan

This web application uses an Arrested Development API that lists all available quotes by different characters of a hit sitcom show Arrested Development

Table of Contents

Description

Arrested Development API is an API that when requested to GET all quotes by each character of the show, will return a response containing all quotes. Arrested Development API is seeded with over 400 quotes by each of the show's characters in the database. The user can click Next button and Prev button to view different quotes being call from the API.

Technologies Used

  • C#
  • .Net 6
  • ASP.NET Core Web API
  • Visual Studio Code 2019
  • MySql
  • MySql Workbench
  • Entity Framework Core 6
  • Pomelo Entity Framework Core 6 MySql
  • ASP.NET Core Identity
  • (Optional) Postman

Setup/Installation Requirements

  • Install .Net 6 SDK:
  • OS X and Windows Instructions
  • Setup MySql Workbench:
  • OS X and Windows Instructions
  • Clone this repo to a local directory
  • _Navigate to the local directory (YourPath/ArrestedDevelopment.Solution/ArrestedDevelopmentClient) and create a new file "appsettings.json"
  • _Open this file with Visual Studio Code 2019 and add:
{
  "Logging": {
    "LogLevel": {
      "Default": "Information",
      "Microsoft.AspNetCore": "Warning"
    }
  },
  "AllowedHosts": "*"
}

  • Using Terminal on OS X or PowerShell on Windows navigate to the directory of the ArrestedDevelopmentApi repo, then the ArrestedDevelopmentApi folder (YourPath/ArrestedDevelopmentApi) and run the terminal commands (without the '$'):
  • $ dotnet ef database update
  • Making sure you've followed the MySqlWorkbench installation instructions, open MySql Workbench and select the Local 3306 server
  • Confirm the database [YOUR-DB-NAME] that you named was successfully created by clicking on the "Schemas" tab and seeing the schema listed.
  • Then run the program with command :
  • $ dotnet watch run
  • This will autolaunch Swagger in your browser
  • Test any API endpoints in Swagger, POSTMAN, or your own app

API Endpoint Guide and Example

GET http://localhost:5000/api/quotes/
  • Returns all quotes in the database

Postman Example:
Start a new GET request in Postman and enter the above URL. Click Send. You should see a JSON response with all quotes in the database.

Example Return Response:

[
  {
    "quoteId": 2,
    "speaker": "Buster",
    "text": "What do you expect, Mother? I'm half machine!"
  },
  {
    "quoteId": 3,
    "speaker": "Buster",
    "text": "I'm a monster!"
  }
]
GET http://localhost:5000/api/quotes/{id}
  • Returns a quote with the matching quoteId
  • Replace {id} with the quoteId you would like to GET
  • Tip: You can find all quoteId's from requesting GET http://localhost:5000/api/quotes/ end point

Postman Example:
Start a new GET request in Postman and enter the above URL. Click Send. You should see a JSON response with the quote that matches the quoteId you entered.
Example Return Response for quoteId equals 7:

{
    "quoteId": 7,
    "speaker": "Unknown",
    "text": "You could charm the black off a telegram boy"
}
POST http://localhost:5000/api/quotes/
  • Creates a new quote in the database

Postman Example:
Start a new POST request in Postman and enter the above URL. A POST request must have a request body when sending. To create a request body, click the Body tab located under where you entered the url, and select raw. In the dropdown menu to the right change Text to JSON. Enter a JSON request body replacing "string" with the value you would like to enter.
Example Request Body:

{
    "quoteId": 0,
    "speaker": "string",
    "text": "string"
}

Click Send. You should see a JSON response with the quote that you entered.

PUT http://localhost:5000/api/quotes/{id}
  • Updates a quote in the database

Postman Example:
Start a new PUT request in Postman and enter the above URL. A PUT request must have a request body when sending. To create a request body, click the Body tab located under where you entered the url, and select raw. In the dropdown menu to the right change Text to JSON. Enter a JSON request body replacing "string" with the values you would like to enter and 0 with the quoteId you would like to update. Note: You must enter an quoteId in the request body, and the entire body's values must still be assigned with either new or old values.
Example Request Body:

{
  "quoteId": 0,
  "speaker": "string",
  "text": "string"
}

Click Send. You should see a JSON response with the quote that you updated.

DELETE http://localhost:5000/api/quotes/{id}
  • Deletes a quote in the database

Postman Example:
Start a new DELETE request in Postman and enter the above URL. Click Send. You should see a return status of 204 No Content.
Confirm the quote was deleted by requesting GET http://localhost:5000/api/quotes/{id} and seeing a return status of 404 Not Found.

Optional Path Parameters When Using Get All Quotes Endpoint

Parameter Type Required Description
Speaker String Not Required Returns the character that match the quote
Question String Not Required Returns the quote that end with a question

Example Query

https://localhost:5001/api/quotes?question=true

Example Returned JSON Response

{
    "quoteId": 8,
    "speaker": "Unknown",
    "text": "Did you see the new Poof?"
}

Futher Exploration: Pagination

Known Bugs

N/A

License

Enjoy the site! If you have questions or suggestions for fixing the code, please contact me!

MIT

Copyright (c) 2023 Brishna Bakshev, Kai Clausen, Mike Donovan

arresteddevelopment.solution's People

Contributors

bbakshev avatar kaisama92 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.