To install the necessary dependencies, run the following command at the root directory:
npm install
express
- For creating web serverartillery
- Load testing toolkit for assessing application and API performance. Installed globally to enable execution of theartillery
command on the command line.
The code in /question1
directory represents the solution for Question 1.
Navigate to the root directory and execute the following command to run the code for Question 1:
node question1/index.js
The code in /question2
directory represents the solution for Question 2.
/generate-unique-256-hash
- Generates a unique SHA-256 hash string./find-odd-ending-hash
- Requests a hash string from the/generate-unique-256-hash
endpoint until it finds a hash where the last character is an odd number.
- Start the server for Question 2 by running
node question2/index.js
- Use your preferred methods (e.g. open in browser or tools like Postman) to interact with the endpoints
For load testing, ensure Artillery is installed globally. If not installed, run npm install -g artillery
To perform load testing, execute the following command at the root directory:
artillery run question2/loadtesting.yaml
This command executes the load testing script defined in question2/loadtesting.yaml.
Here is the sample load test summary: