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.
- Clone the repository:
git clone https://github.com/ankitkatole/UrbanGO.git cd UrbanGO - Install dependencies:
npm install - Set up your environment variables in a
.envfile (see Environment Variables section for details). - Start the server:
node index.js
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
- 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 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" }
- 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" }
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
- 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.
- Register a new user by sending a POST request to
- Search for Travel Services
- Use the appropriate endpoints to search for flights, hotels, cars, or famous places.
- Cart Management
- Add items to the cart, view cart information, remove items from the cart, and proceed to checkout using the cart endpoints.
- 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.
- If a user forgets their password, they can request a password reset link by sending a POST request to
This setup provides a fully functional travel service API with user authentication, search capabilities, and cart management.