Skip to content

Instantly share code, notes, and snippets.

@priteshgudge
Last active July 15, 2019 07:25
Show Gist options
  • Select an option

  • Save priteshgudge/5a1c94445f2803a898e13ec5eb672d32 to your computer and use it in GitHub Desktop.

Select an option

Save priteshgudge/5a1c94445f2803a898e13ec5eb672d32 to your computer and use it in GitHub Desktop.
Simple Read Write Rest API

Problem for simple rest api and database read write

Sample data source:

https://github.com/ozlerhakan/mongodb-json-files/blob/master/datasets/restaurant.json

Tasks:

  1. Write a script - to import the documents separated by newline into a table/collection named "restaurant"

  2. Write a Rest API which accepts the below arguments and provides the results based on filters provided below.

  3. Good naming conventions and programming practices should be followed.

A) Following filters should work for restaurant search should work:

Filter: typeOfFood=Thai
 --> returns name:postcode of the all the matching restaurants with total count and pagination

Filter: postcode=8FY 
 --> returns name:type_of_food of all matching restaurants with total count and pagination

B) Update Only the Name of a restaurant by ID

API to update the name of the restaurant by ID

Notes:

  1. Code has to be pushed to your own github public repository
  2. Code commits should have appropriate messages
  3. Use comments/Doc Line against each public Method
  4. Deployment steps or shell script/docker image should be provided.
  5. Code has to be modular, separating out at least DB access methods and API layer
  6. Basic tests covering core functionality have to be written.
  7. API documentation/Postman Collection for the REST Apis to be provided
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment