Git Product home page Git Product logo

getir-challenge's Introduction

getir-challenge

A RESTful API with a single endpoint that fetches the data in a MongoDB collection

Features

  • User can fetch records filtered by startDate, endDate, minCount and maxCount.

API Endpoints

Response codes

Every response has a code which can be one of the following:

  • 0 - Success
  • 400 - Bad request
  • 404 - Not Found
  • 500 - Internal Server Error

Records

  • POST: /records

    • Request Body
      {
        "startDate": "2016-01-21",  // Date 'YYYY-MM-DD`
        "endDate": "2019-01-21",    // Date 'YYYY-MM-DD`
        "minCount": 200,            // number
        "maxCount": 2000            // number
      }
    
    • Sample response
      {
        "code": 0,
        "msg": "Success",
        "records": [
          {
              "key": "TAKwGc6Jr4i8Z487",
              "createdAt": "2017-01-28T01:22:14.398Z",
              "totalCount": 310
          },
          ...
        ]
      }
    

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

What things you need to install the software and how to install them To get the project up and running, you need to have mongodb, nodejs and npm installed on your local machine.

Run the following commands to confirm installations.

node -v
  • should display Node version
npm -v
  • should display npm version
mongo --version
  • should display mongdb version

Installing

  • Clone the repository git clone https://github.com/kenzdozz/getir-challenge.git
  • Navigate to the location of the folder
  • Run npm install to install dependencies
  • Run npm start to get the app started on your local machine

Set Environment Variables

Rename .env.example to .env and update the variables accordingly

Running the tests

To run the tests, run the command

npm run test

The tests, test the api endpoints to ensure that it works and returns the required data.

Built With

  • Nodejs - Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine
  • Express - Fast, unopinionated, minimalist web framework for Node.js
  • MongoDB - MongoDB is a cross-platform document-oriented database program

Authors

License

This project is licensed under the MIT License

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.