Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

Mean Developer

Challenge

About Us
Coutloot is India’s Fastest growing O2O fullstack service e-com platform,
where you can easily open up your online store and start your business
within 30 seconds. With millions of users everyday buying and selling
fashion, electronics, home decor - coutloot is building trust and next
digitized supply chain in India.
We are building a team who has in them to understand and execute our
vision of enabling 5 million Indians making money for the first time in
their lives using our platform.
Find Us here - https:/ /www.coutloot.com/app/download

Task 1 :
Objective : To design a request routing algorithm using core node js.

Problem Statement : Consider you are receiving large no requests on


your (http/https) server, requests are then redirected to different
microservices running on different servers on different ports .Also there
are multiple instances of same microservice are running on different
servers. So all requests should be equally distributed to their specific
microservices.
Example : Consider https://www.xyz.com/api/v1/product/list is public
endpoint, And actual service is running on following vpc servers -
http://127.0.0.1:3000/products/list

http://192.168.0.1:3800/products/list

http://192.168.0.2:3000/products/list

http://192.168.0.2:3800/products/list

Note : Every endpoint is defined as an object. There are around 300


different endpoint objects stored in an array.Endpoint object structure
is given in following link -
https://jsoneditoronline.org/?id=fb05853d33d54c6896977f509566540d

** Implementation of redirection code is optional. Main objective is to


implement routing algorithm.
** data structure and time complexity should be considered.

Assumptions : Average request rate is 300 Req/Sec, Average request


time 300 ms.
Do not use any third party library,

Follow standard design practices.

Use core node server and libraries.

Avoid use of callback functions in db calls. Instead use async/await with


promises when required.

Task 2 :
Objective : To complete below mentioned tasks using Node js, Express,
MongoDB, Redis (Optional), Data set will be provided.

Design strict Schema for data object.

Follow standard design practices.

Use express as node server.

Avoid use of callback functions in db calls. Instead use async/await with


promises when required.

SubTask 1 : Get list of products.

Details : Get list of approved products, with given filters applied,page


size is 30 products per page. If next page is available send response
parameter nextPage:1 else 0
Endpoint : /product/list
Method : Post
Request :
Headers: userId, deviceId
Body:{"type":"Brand","sort":0,"pageNo":0,"filters":[{"color":["Red","Blue"]},
{"price":["100-300"]}],"extraParam":"Zara"}

//Types :
subcat : subcategory id will be extraParam (Search in category
categoryIdString)
userCloset : userId will be extraParam (search in sellerdetails userId)
brand : brand name will be extra param (search in detrails brand)

SubTask 2 : Get product details.

Details : Get product details.


Endpoint : /product/details
Method : Post
Request :
Headers: userId, deviceId
Body:{productId:1234}

Note : add views key in schema. Increase views when same route is
called. productView from same device twice or more per day should be
considered.(Use redis to store daily product views)

SubTask 3 : Edit Product varient price.

Details : Edit product varient price (listedPrice), There can be multiple


variants in a product with unique sku,price should not be greater than
lablePrice. sku and productId will provided
Endpoint : /product/action/edit
Method : Post
Request :
Headers: userId, deviceId
Body:{“productId”:1234,”sku”:”sku”}

Note : add product log if price changes.

Thank You
All the Best

You might also like