Skip to content

getir-nodejs-bootcamp/getir-nodejs-bootcamp-graduation-project-burakkisacik

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Getir Case Study

getirLogo

Description

A RESTful API with a single endpoint that fetches the data in the provided MongoDB collection and return the results in the requested format

Deployed URL

URL: https://getir-case-study-burakkisacik.herokuapp.com/

Endpoint : POST /api/v1/records

Installation

git clone the repository
 cd into the folder
 npm install
 npm run dev

Run Tests

npm test

Test Suites

  • given request payload is in desired format
  • given request payload is in desired format but not match to any records
  • given request payload's date format is wrong
  • given request payload's count range format is wrong
  • given request payload has extra fields
  • given request payload has missing fields

Example DB Schema

dbSchema

Endpoints

POST /api/v1/records

Request Payload

{
   "startDate": "2015-01-01",
    "endDate": "2016-01-01",
    "minCount": 0,
    "maxCount": 10,
}
Parameter Type Description
startDate String format => YYYY-MM-DD & results will be gte
endDate String format => YYYY-MM-DD & results will be lte
minCount Integer results will be greater than minCount
maxCount Integer results will be less than maxCount

How it works

Example Request

axios
  .post("https://getir-case-study-burakkisacik.herokuapp.com/api/v1/records", {
    startDate: "2015-01-01",
    endDate: "2016-01-01",
    minCount: 0,
    maxCount: 10,
  })
  .then((response) => {
    console.log(response.data);
  });

Example Response

{
  code: 0,
  msg: 'success',
  records: [
    {
      key: 'nYYhzbmi',
      createdAt: '2015-11-17T03:03:18.052Z',
      totalCount: 4
    }
  ]
}

Technologies

  • Node.js
  • Express
  • MongoDB
  • Mongoose
  • Jest & Supertest
  • Winston & Morgan
  • Cors, helmet, xss-clean, hpp, express-mongo-sanitize
  • Colors
  • dotenv

About

getir-nodejs-bootcamp-graduation-project-burakkisacik created by GitHub Classroom

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published