GithubHelp home page GithubHelp logo

ombito / phase4codechallenge-2 Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 213 KB

This is my Phase 4 Code Challenge 2.

License: MIT License

HTML 9.87% CSS 5.34% JavaScript 16.61% Python 65.35% Mako 2.83%

phase4codechallenge-2's Introduction

Flask Code Challenge - Pizza Restaurants

This is a Flask application that manages Pizza Restaurants and their associated Pizzas through the RestaurantPizza model. This application is built to interact with a backend API that handles the Pizza Restaurant domain, including models, relationships, and validations.

Getting Started

To set up and run the project, follow these steps:

  1. Install project dependencies for both the backend and frontend:

    pipenv install
    npm install 
  2. Create the required database tables and seed data:

    • Generate the models and migrations for the database tables.

    • Run the migrations and seed data with the following commands:

    flask db upgrade
    python app/seed.py
  3. Run the Flask API on localhost:5555:

    python app.py
  4. Run the React app on localhost:4000:

    npm start 

The React frontend application should now be running on http://localhost:3000.

Models

The Pizza Restaurant domain includes the following models and relationships:

  • Restaurant has many Pizzas through RestaurantPizza.
  • Pizza has many Restaurants through RestaurantPizza.
  • RestaurantPizza belongs to a Restaurant and belongs to a Pizza.

These models are implemented in the backend API, and this frontend application interacts with them through API requests.

Validations

The RestaurantPizza model in the backend API has the following validation:

  • price must be between 1 and 30.

Routes

The Pizza Restaurant React frontend application interacts with the following API routes. Each route corresponds to a specific HTTP verb and returns data in the specified JSON format:

  • GET /restaurants: Retrieve a list of all restaurants.
  • GET /pizzas: Retrieve a list of all pizzas.
  • POST /restaurants: Create a new restaurant.
  • POST /restaurants_pizzas: Create a new pizza.
  • GET /restaurant-pizzas: Retrieve a list of all restaurant-pizza relationships.
  • POST /restaurant-pizzas: Create a new restaurant-pizza relationship.
  • PUT /restaurant-pizzas/:id: Update an existing restaurant-pizza relationship.
  • DELETE /restaurant-pizzas/:id: Delete an existing restaurant-pizza relationship.

Usage

This React frontend application allows you to interact with the Pizza Restaurant domain through a user-friendly interface. You can perform the following actions:

  • View a list of all restaurants and their associated pizzas.
  • View a list of all pizzas and the restaurants where they are available.
  • Create new restaurants and pizzas.
  • Create new relationships between restaurants and pizzas.
  • Delete restaurants by id.

Please refer to the application's user interface for a seamless experience.

Contributing

If you would like to contribute to this project, please follow the standard open-source contribution guidelines and submit pull requests. For major changes, please open an issue first to discuss what you would like to change.

License

This project is licensed under the MIT License.

phase4codechallenge-2's People

Contributors

ombito 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.