Details: This is a Tour Management Server. It is build by following MVC Pattern. User can can get data by apply multiple filter. User can update any details of the data. I have maintained a structure by creating model and Schema using mongoose.
GET/tours (Check Here)
- Get All Tour
- User can select some specific fields for getting the information he needs as query.
- Paginated
- User can send a field (e.g. price) as query to sort the data with it.
/tours?fields=name,price,views&sort=price&page=1&limit=5
POST/tours (Check Here)
- ADD/Insert a new Tour from body data.
- Schema based data structure with validation.
/tours
const newTour = {
name: "Example Tour",
description: "This a fake tour. If you like adventure and want to be fool you are welcome to this tour..!",
price: 5000,
image: "https://ibb.com/exampletour.jpg",
destination: "Suresshor",
travelDate: 2022-12-31
}
GET/tours/:id (Check Here)
- GET a tour details by id
- GET all the information of the tour.
- When hit the API It increase the view count by 1.
/tours/63287025ba218b4646cb4fde
PATCH/tour/:id (Check Here)
- Update a tour data from body data.
- Update data validation with Tour Model & Schema.
/tour/63287025ba218b4646cb4fde
const updateData = {
price: 5500,
travelDate: 2022-12-30
}
GET/tour/trending (Check Here)
- GET Top 3 trending/most visited tour.
/tour/trending
GET/tour/cheapest (Check Here)
- GET Top 3 Cheap price tour.
/tour/cheapest