The application delivers 2 REST APIs as lambdas with configuration residing in DynamoDb. Initial development is local using Serverless Framework with local configs defined using dotEnv
Unit Tests would use jest, which would drive SOLID principle development, where functions do 1 thing and all dependencies are mocked. That way, tests are isolated, there is no chance of affecting external databases or infrastructure, errors can be identified quickly, and tests can be simple.
Where time permits, the code is written to be self documenting Classes have not been used for simplicity. The only class used is DynamoDb which retains the db connection
- Dont use relative paths
- Complete unit tests with 100% coverage.
- Clarify requirements, ie request directions
- Complete
getGateway
- similar togetSupplier
The Server can be started at command line with:
npm run start:si
From the browser, enter the following in the address bar
http://localhost:3000/supplier/BigCorp?characteristics={"name":"LINE_ID","value":"ABC/123"}
{"message":"Supplier Characteristics","characteristics":[{"name":"LINE_ID","value":"ABC/123"}]}
If data sent doesnt match, return:
{"message":"Supplier Characteristics","characteristics":[]}
If query data is not well formed, error returns
message: "Mapping Not Found"