Postman API Doc

Getting Started

  1. Clone the Repository
    git clone https://github.com/Landienzla/Cerebrum-Tech-Flight-API.git
    cd Cerebrum-Tech-Flight-API
  2. Create and Fill the .env File

    Before starting, create a .env file at the root of the project. You need to set GMAIL_ADDRESS and GMAIL_PASSWORD environment variables for sending email verification mails. If these are not provided, make sure to read the documentation carefully for alternative configurations.

  3. Install Dependencies
    npm install
  4. Set up PostgreSQL Database

    Make sure you have PostgreSQL installed and running. Update the database connection details in the configuration file.

  5. Start the Development Server
    npm run develop
  6. Build and Run the Application
    1. Build the application by running:
      npm run build
    2. Start the application in production mode using:
      npm run start:prod

Your application should now be running at http://localhost:3001.

Directory Structure

Briefly describe the layout of your project, e.g.,

  • src/: All the TypeScript server code resides here.
    • routes/: Contains Express route definitions for the various API endpoints.
    • controllers/: Houses the logic for handling requests and responses for each route. Controllers are responsible for interfacing between the API routes and the database models.
    • middlewares/: Includes middleware functions used across the application. Middlewares are used for tasks like request processing, authentication, error handling, and other common functions that are executed during the HTTP request-response cycle.
    • utils/: Utility functions that provide common functionalities used throughout the application, such as helper functions, data formatting, and other shared logic.

Application Capabilities

This application offers a comprehensive suite of features for handling flight-related operations, user authentication, and reservation management. Below is an overview of the core functionalities:

User Authentication and Management

  • User Registration and Login: Secure registration and login processes for users.

  • Email Verification: After registering, users receive an email verification link to ensure the authenticity of their email address.

Flight Information

  • Flight Listing: Users can view a list of available flights. The listing functionality includes various filters for ease of searching.

  • Flight Details: Detailed information about specific flights can be accessed, providing users with comprehensive data about flight schedules, durations, and more.

Reservation System

  • Making Flight Reservations: Users can make reservations on available flights, choosing their preferred seats.

  • Cancelling Reservations: Users have the flexibility to cancel their reservations if their plans change.

  • Listing User Reservations: Users can view all their reservations, both past and upcoming, in one place.

  • Reservation Details: Detailed view of a specific reservation, including flight details, seat number, and reservation status.