Write an REST based API using API Gateway which takes name, email, password in JSON format from HTTP POST, calls a LAMBDA function which validates the format of that data and stores that in DB of your choice. Preferable Dynamo DB or Redis. This should take 45 minutes
* Create User Route
* Creates a user
* Unique email validation
* Password validation
* String and length field validation
* List Users Route
* Lists users
* User friendly dates
* Default sort by email
-
Email is the partition key, and the only field that is nessacerily unique, since we're using a DynamoDB is a key:value store to save our users.
-
Since it's a simple app, I put helper function directly underneath the handlers that use them instead of in a utils file.
Creates a new user with a unique email address.
curl -d '{"name": "sam", "email": "test@test.com", "password": "Test123676767"}' \
-H "Content-Type: application/json" \
-X POST https://st23564ow0.execute-api.us-east-1.amazonaws.com/dev/users
{
createdAt: timestamp,
email: "",
name: "",
password: "",
updatedAt: timestamp
}
Lists all users, with their passwords encrypted.
This route mainly exists to make testing easier for the reviewer. Since this is a demo, there are no admins and this route is totally public.
https://st23564ow0.execute-api.us-east-1.amazonaws.com/dev/users
{
count: 6,
users: [{
createdAt: timestamp,
email: "",
name: "",
password: "",
updatedAt: timestamp
}]
}
Note: You will need you're own set of AWS credentials
If the app fails to build for any locally for reason it can still be tested using the dev routes above.
cd [into_project]
virtualenv -p python3 .venv
source .venv/bin/activate
pip install -r requirements.txt
# Install local lambda dependencies &
# set up db
npm install
npm run build-dev
npm run dev