Cloud Computing Assignments
Name: Ishan Subodh Joshi
NUID: 002836254
APIs To Implement¶
- Your web application must only support Token-Based Basic authentication and not Session Authentication.
- As a user, I must provide a basic authentication token when making an API call to the authenticated endpoint.
- Create a new user
- As a user, I want to create an account by providing the following information.
- Email Address
- Password
- First Name
- Last Name
account_created
field for the user should be set to the current time when user creation is successful.- Users should not be able to set values for
account_created
andaccount_updated
. Any value provided for these fields must be ignored. Password
should never be returned in the response payload.- As a user, I expect to use my email address as my username.
- Application must return 400 Bad Request HTTP response code when a user account with the email address already exists.
- As a user, I expect my password to be stored securely using the
BCrypt
password hashing scheme with salt.
- As a user, I want to create an account by providing the following information.
- Update user information
- As a user, I want to update my account information. I should only be allowed to update the following fields.
- First Name
- Last Name
- Password
- Attempt to update any other field should return 400 Bad Request HTTP response code.
account_updated
field for the user should be updated when the user update is successful.- A user can only update their own account information.
- As a user, I want to update my account information. I should only be allowed to update the following fields.
- Get user information
- As a user, I want to get my account information. Response payload should return all fields for the user except for password.
Web Application - Integration Tests¶
Danger
Do not implement tests using curl
or postman
. You will need to execute the tests as part of pull requests and add them to status check.
- Implement integration (and not unit) tests for the
/v1/user
endpoint with a new GitHub Actions workflow. Do not delete workflow from previous assignments as it must continue to function in parallel to the new one. - Test 1 - Create an account, and using the GET call, validate account exists.
- Test 2 - Update the account and using the GET call, validate the account was updated.
- This will require your GitHub action to install and setup an actual
MySQL
andPostgreSQL
instance and provide configuration to the application to connect to it.
npm i
DB_NAME=webapp
DB_USER=webapp
DB_PASSWORD=<password>
DB_HOST=localhost
PORT=5432
NODE_ENV=dev
npm run test
npm run dev