By Thomas Dodd
This solution was acheived using Node and Express. Unit tests are written using Mocha and Chai.
You must have Node.js installed on your machine
Clone the project: git clone https://github.com/tdodd/shopify-backend-challenge.git
cdinto the project directory- Install dependencies with
npm install.
Once this is complete, you can start the application via npm start and run tests via npm test.
The application architecture is as follows:
- The client sends a request to
/customers/{pageNumber} - The router receives this request and uses 2 controllers to perform jobs
CustomerControllerget the list of customers from the APIValidationControllerperforms the validation on the customers that were retreived
- The router then sends the invalid clients as a JSON object to the client
Sample response:
{
"invalid_customers": [
{ "id": 1, "invalid_fields": ["name", "age"] },
{ "id": 3, "invalid_fields": ["password"] }
]
}