- Web Server - NodeJS + ExpressJs
- Test Framework - Mocha + Chai
- API Docs - Swagger JS Docs
The web server exposes two APIs
- For getting co-ordinates of a city - GET /locations
- For getting list of hotels nearby - GET /hotels
From front-end, the first API should be invoked with search text for a location, it can be a address, city name, district name or country name. The api will return list of matching locations asitems in which Latitude and Longitude are returned for each item.
These Latitude and Longitude are to be sent in second api call along with radius of search in Kilometers and optionally, page size. The api will return, list of matching hotels as items which will have details about the hotel such as name, address etc. along with nextToken for fetching next set of items and previousToken for previous set of items.
URL : https://hotel-search-backend.herokuapp.com/
- Clone the repo
- Set values in
config/development.jsforHERE_APP_IDandHERE_APP_CODEOR rename.env.sampleto.envand set values in the file. Note: Make sure you dont commit these changes - run
npm install - run
npm run start-devfor hot-reload enabled env - Browse `http://localhost:3000/' in browser
- For running test cases -
npm run test - For checking coverage -
npm run coverage - For linting code -
npm run lint - For fixing lint issues -
npm run lint:fix - For formatting code -
npm run lint:format
- Build docker image using -
docker build -t hotel-backend-api:local . - Run app using docker -
docker run -it -p 8000:3000 -e HERE_APP_ID=<your_app_id> -e HERE_APP_CODE=<you_app_code> hotel-backend-api:local - Browse `http://localhost:8000/' in browser