This repo is a response to Finimize's full-stack dev challenge!
You will need node.js and yarn installed.
- Install dependencies by running
yarn install
. - Run
yarn start
to start both, the API and the Client. - Look at your browser.
- That's it! :)
- Run
yarn test
from the root directory to run all tests (back-end + front-end)
Note: You can also run yarn test-client
or yarn test-server
to only run tests for a specific side of the application. Running cd client && yarn test
will run all front-end tests in watch mode.
- This application can be easily deployed to AWS by running
yarn deploy
. This will bundle the whole app (server + client) using webpack and upload it to a lambda function. If everything goes as expected, the command will end by outputting logs with a live endpoint where the App can be accessed!
NOTE: To run yarn deploy
, you will need to create an AWS account (if you don't have one already) and setup an AWS profile named playground
.
If all goes well you should be able to have a working app that looks like this:
-
Spec
query param required type default must be initial_savings yes number - >= 0 monthly_deposit yes number - >= 0 start_year no integer 0 >= 0 end_year no integer 50 >= start_year start_interest no integer 0 >= 0 end_interest no integer 15 >= start_interest -
Response type:
type ResponseBody = {
projections?: {
[interestRatePercentage: number]: {
[year: number]: number
}
}
errors?: Array<{
value: string
msg: string
param: string
location: string
}>
}
- Example 1 - valid response
const query =
'/getProjections?initial_savings=1000&monthly_deposit=100&start_year=0&end_year=1&start_interest=0&end_interest=2'
const response = {
projections: {
0: {
0: 1000,
1: 2200,
},
1: {
0: 1000,
1: 2215.5612673489027,
},
2: {
0: 1000,
1: 2231.245696571609,
},
},
}
- Example 2 - invalid request
const query = '/getProjections?initial_savings=1000&monthly_deposit=100&start_year=0.4'
const response = {
errors: [
{
value: '0.4',
msg: 'must be an integer',
param: 'start_year',
location: 'query',
},
],
}
Thanks for reading!