Coder Social home page Coder Social logo

little_lemon's Introduction

Little Lemon Web Application ๐Ÿ‹

A vibrant Django-based web application designed to manage the Little Lemon Restaurant's menus and table bookings.

๐Ÿš€ Prerequisites

Ensure you have the following installed on your local machine:

๐Ÿ› ๏ธ Setup & Installation

Backend (Django)

  1. Clone the Repository
    git clone https://github.com/Waariss/Little_Lemon.git 
  2. Navigate to the Backend Project Directory
    cd Little_Lemon/backend
  3. Install Required Packages
    pip install -r requirements.txt
  4. Configure Database
    • Update settings.py with your MySQL database credentials.
  5. Run Migrations
    python manage.py migrate
  6. Start the Server
    python manage.py runserver

Frontend (React)

  1. Navigate to the Frontend Project Directory
    cd Little_Lemon/frontend
  2. Install Required Packages
    npm install
  3. Start the React App
    npm start
  4. Access the Application

๐Ÿ“Œ API Endpoints

Menu Management

  • List & Create Menu Items
    • Endpoint: /api/menu/
    • Methods:
      • GET: Retrieve all menus.
      • POST: Create a new menu item.

Booking Management

  • List & Create Bookings
    • Endpoint: /api/bookings/
    • Methods:
      • GET: Retrieve all bookings.
      • POST: Create a new booking.
  • Manage Table Bookings
    • Endpoint: /api/bookings/<booking_id>/
    • Methods:
      • GET: Retrieve a specific booking.
      • PUT: Update an existing booking.
      • DELETE: Delete a booking.

๐Ÿ”„ Integrating Frontend with Backend

  1. API Calls: Use a library like Axios to make HTTP requests from your React app to your Django API.

    Install Axios:

    npm install axios

    Example API call from React:

    import axios from 'axios';
    
    axios.get('http://127.0.0.1:8000/api/menu/')
         .then(response => {
             console.log(response.data);
         })
         .catch(error => {
             console.error('Error fetching data: ', error);
         });
  2. CORS Headers: Ensure that your Django API can handle requests from your React app by configuring CORS headers using django-cors-headers.

  3. Build & Deploy: When you're ready to deploy your application, build your React app and configure Django to serve the static files.

    Build React app:

    npm run build

๐Ÿงช Testing

Utilize the Insomnia REST Client or a similar tool to test the API endpoints.

๐Ÿ“œ License

This project is licensed under the MIT License

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.