- nodejs (it was developed and tested on v10.4.1)
- mongo database.
- install all externall dependencies:
npm install
- rename
.env.example
to.env
- set up database connection details in .env file:
dbPort
(default to 27017),dbHost
(default to localhost) anddbName
- run with
node index.js
path | method | response |
---|---|---|
/api/all/stats | GET | Returns a list of review statistics per airport. Each item consists of the fields airportName and reviewCount |
/api/:airport_name/reviews | GET | Returns a list of reviews for the given airport, ordered by date . The latest review is returned as the first element. Each list item contains the following fields: 1. date 2. overallRating 3. recommended (flag)4. authorCountry 5. content you can pass threshold param to show only reviews that exceed a given overall rating threshold for a given airport |
/api/:airport_name/stats | GET | Returns detailed stats for a given airport including the following fields: 1. airportName 2. reviewCount 3. averageOverallRating 4. recommendationCount (number of reviews with recommended == 1 ) |
/api/import/csv | POST | Import data from CSV file to database (Doubles are ignored). Use content-type: form-data and put yopur file in file param. |
/api/flush | POST | will remove all reviews (I added this for testing purposes only. Real application most likely should not have this) |
Example instance of this app available at 176.107.176.108:8081
Postman collection to play with this: https://www.getpostman.com/collections/41d45c7336935d297bf1
- solve problem with doubles during import
- add eslint
- add logger (winston)
- tests
- restrict access fo import/flush APIs
- params validation