This repository is created to fetch hotels data from Tajawal api and apply search and sorting on this data .
- npm
- node > 9
npm install && npm start
- filter criterias are
name ,price,city,date(availability)
price
anddate
criteria accept range format, for example :120:150
and10-10-2020:15-10-2020
- To fetch all hotels use
/hotels
endpoint - To filter hotels with a criteria add query paramater after
/hotels
endpoint/hotels?name=Concorde Hotel
- To sort hotels add add query paramater
sort_by
after/hotels
- To search and sort
http://localhost:3000/hotels?price=50:200&sort_by=price
- Get hotel details by name
http://localhost:3000/hotels?name=Concorde%20Hotel
- Get hotel details by price and city
http://localhost:3000/hotels?price=102.2&city=dubai
- Sort hotels by price
http://localhost:3009/hotels?sort_by=name
- If you searched a hotel by name (ex :
Dubai
) , the word Dubai will be converted to lowercase lettersdubai
(better user experience) - For price range , the first value shouldn't be greater than the second value .
npm test
- Adding better error handling
- Validation
- Date Range search (availability)
- Adding Docker image for easier installation
- Adding test coverage to codeclimate