Git Product home page Git Product logo

dreamlinestest's Introduction

dreamlinesTest

Requirements

  1. nodejs (it was developed and tested on v10.4.1)
  2. mongo database.

Installation

  1. install all externall dependencies:
npm install
  1. rename .env.example to .env
  2. set up database connection details in .env file: dbPort(default to 27017), dbHost(default to localhost) and dbName
  3. run with node index.js

APIs

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

TODO

  1. solve problem with doubles during import
  2. add eslint
  3. add logger (winston)
  4. tests
  5. restrict access fo import/flush APIs
  6. params validation

dreamlinestest's People

Contributors

set001 avatar

Stargazers

Andrejs Agejevs avatar

Watchers

 avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.