Demo Shopping Service
AWS lambda function that provides wardrobe suggestions based on the current weather at a location.
Online Demo
Running Locally
The NPM package contains both the client and the server code.
Install with: npm i demo-shopping-service
AWS Lambda Function (Service)
-
Change directory to server:
cd service
-
Install the dependencies:
npm install
-
Run all tests:
npm run test
Deploying Service on Your Own Amazon Web Services
-
Create IAM user with API access and put the user in the "administrator" policy.
-
Install the servrless NPM package
npm i serverless -g
-
Configure serverless credentials
serverless config credentials --provider aws --key AKIAIOSFODNN7EXAMPLE --secret wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
-
Deploy
serverless deploy
-
Run:
serverless invoke -f suggest -l -p .\src\data\zipCode.json
serverless invoke -f suggest -l -p .\src\data\zipCodeExtended.json
serverless invoke -f suggest -l -p .\src\data\zipCodeInvalid.json
Client (Angular)
- Change directory to client:
cd .\client
- Install the dependencies:
npm install
- Run the client:
ng serve
- Browse to
http://localhost:4200
Technologies
- Angular for demo client consumer
- Chai for assertions and expectations in unit testing
- DefinitelyTyped for Type Script definition files for existing npm packages.
- Mocha for unit testing
- TypScript for strongly typed JavaScript
- Serverless for testing and deployment
- Sinon for spies, mocks and stubs in unit testing
- Webpack for compilation and bundling