Create a small API to help a small fictional company calculate the dates on which they should pay their sales staff. Company payroll is handled like so:
-
Sales staff are paid a regular fixed base salary each month, plus a regular monthly bonus.
-
Base salaries are paid on the last day of each month unless that day is a Saturday or Sunday (a weekend), in which case they are paid on the Friday before the weekend
-
On the 15th of each month, bonuses are paid for the previous month, unless that day is a weekend, in which case they are paid on the first Wednesday after the 15th.
Your API should accept a date as a parameter, and return the payment dates for the following 12 months, including the supplied date. Results should be returned in CSV format.
Crate .env
file and copy .env.example
file's content to it
node >=14.17.5
yarn installed
yarn
yarn start // production mode
yarn start:dev // development mode
yarn test // run tests
You should be able to display salaries.csv by entering the endpoint
localhost:3000/salaries
IMPORTANT! date
param in is required (format YYYY-MM-DD)