Giter VIP home page Giter VIP logo

flask-airline's Introduction

Airline System Backend Server

This backend server is built using Flask, MongoDB, and mongoengine, following the MVC (Model-View-Controller) pattern.

Installation

  1. Clone the repository from GitHub:
git clone <repository_url>
  1. Install dependencies using pip:
pip install -r requirements.txt

Configuration

  1. Create a .env file in the root directory with the following environment variables:
FLASK_APP=app.py
FLASK_ENV=development
SECRET_KEY=<your_secret_key>
MONGODB_URI=<your_mongodb_uri>

Running the Server

To run the server, execute the following command:

flask run

By default, the server will run on http://localhost:5000.

Endpoints

Authentication and User operation (Admin and Customer)

  • /api/v1/login:
    • POST: to login an existing customer.
  • /api/v1/signup:
    • POST: create a new account for a customer.
  • /api/v1/logout:
    • POST: removes session and logs out all types of user.
  • /api/v1/login/admin:
    • POST: to login an existing admin.
  • /api/v1/login:
    • POST: create a new account for an admin.

Flight Routes Operation

  • /api/v1/flights/search:
    • GET: Search for flights by date, to or from.
  • /api/v1/flights/:
    • GET: Get all the flights status(Admin operation).
  • /api/v1/flights/: :
    • POST: Add a flight (Admin operation).
  • /api/v1/flights/<flightId>:
    • GET: Get the status of a particular flight (Admin operation).
  • /api/v1/flights/<flightId>:
    • DELETE: Delete a flight (Admin operation).

Booking Operations

  • /api/v1/book:
    • GET: Get all the bookings made by the customer.
  • /api/v1/book/<flightId>:
    • POST: Book a flight.

Models

The application uses the following models:

  1. User Model: Represents users of the system.
  2. Flight Model: Represents flight information.
  3. Booking Model: Represents a booking made by a customer.

Folder Structure

  • app.py: Main Flask application file.
  • controllers/: Contains controller logic.
  • models/: Contains data models.
  • routes/: Contains all the routes for the endpoints

Dependencies

  • Flask: Micro web framework for Python.
  • mongoengine: Object-Document Mapper (ODM) for working with MongoDB in Python.
  • PyMongo: Python driver for MongoDB.

flask-airline's People

Contributors

saif-gitreps avatar

Stargazers

 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.