Skip to content

ankitkatole/UrbanGO

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

UrbanGO Server

UrbanGo API

UrbanGo API is a comprehensive travel service that provides information and booking options for flights, hotels, cars, and famous places. It also includes user authentication and cart management features.

Table of Contents

Installation

  1. Clone the repository:
    git clone https://github.com/ankitkatole/UrbanGO.git
    cd UrbanGO
        
  2. Install dependencies:
    npm install
        
  3. Set up your environment variables in a .env file (see Environment Variables section for details).
  4. Start the server:
    node index.js
        

Environment Variables

Create a .env file in the root directory of your project and add the following environment variables:


Environment Variables:

BASE_URL
HOST
SERVICE
EMAIL_PORT
USERK
PASS
MONGO_URI_URBANGO
API_KEY
EMAIL
TOKEN

API Endpoints

User Authentication

  • Register - /user/register
    {
      "fname": "John",
      "lname": "Doe",
      "e_mail": "john.doe@example.com",
      "password": "password123"
    }
        
  • Login - /user/login
    {
      "email": "john.doe@example.com",
      "passwd": "password123"
    }
        
  • Forgot Password - /user/forgotpassword
    {
      "email": "john.doe@example.com"
    }
        
  • Update Password - /user/forgotpassword/user/update
    {
      "email": "john.doe@example.com",
      "passwd": "newpassword123"
    }
        

Search Services

  • Search Flights - /search/flights
    {
      "From": "CityA",
      "to": "CityB"
    }
        
  • Search Hotels - /search/hotels
    {
      "city": "CityA"
    }
        
  • Search Cars - /search/cars
    {
      "city": "CityA",
      "to": "CityB"
    }
        
  • Search Famous Places - /search/famousplaces
    {
      "city": "CityA"
    }
        

Cart Management

  • Add to Cart - /cart/add
    {
      "email": "john.doe@example.com",
      "trips": [
        {
          "type": "flight",
          "data": { ... }
        }
      ]
    }
        
  • Remove from Cart - /cart/remove
    {
      "email": "john.doe@example.com",
      "removetripID": "trip_id"
    }
        
  • Get Cart Info - /cart/info
    {
      "email": "john.doe@example.com"
    }
        
  • Checkout - /cart/checkout
    {
      "email": "john.doe@example.com"
    }
        

File Structure

urbango-api/
│
├── db/
│   └── urbango.js          # Database connection file
│
├── middlewares/
│   └── auth.js             # Authentication middleware
│
├── models/
│   ├── cart.js             # Cart model
│   ├── flights.js          # Flights model
│   ├── hotels.js           # Hotels model
│   ├── famousplaces.js     # Famous places model
│   ├── cars.js             # Cars model
│   └── user.js             # User model
│
├── routes/
│   ├── cart.js             # Cart routes
│   └── search.js           # Search routes
│
├── utils/
│   ├── weather.js          # Weather utility
│   ├── sendmailForgetPasswd.js # Email utility for password reset
│   └── payment.js          # Payment utility
│
├── index.js                # Entry point
├── package.json            # NPM package file
└── .env                    # Environment variables

Usage

  1. User Registration and Login
    • Register a new user by sending a POST request to /user/register.
    • Log in with registered user credentials by sending a POST request to /user/login.
  2. Search for Travel Services
    • Use the appropriate endpoints to search for flights, hotels, cars, or famous places.
  3. Cart Management
    • Add items to the cart, view cart information, remove items from the cart, and proceed to checkout using the cart endpoints.
  4. Forgot Password and Password Reset
    • If a user forgets their password, they can request a password reset link by sending a POST request to /user/forgotpassword.
    • After receiving the reset link, the user can update their password by sending a POST request to /user/forgotpassword/user/update.

This setup provides a fully functional travel service API with user authentication, search capabilities, and cart management.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors