{"id":20485597,"url":"https://github.com/yeehanchung/coding-test-express-nodejs","last_synced_at":"2026-04-11T13:34:47.506Z","repository":{"id":110972528,"uuid":"378627914","full_name":"yeehanchung/coding-test-express-nodejs","owner":"yeehanchung","description":"Backend coding test (Express.js) April 2021 - Test Passed 100%","archived":false,"fork":false,"pushed_at":"2021-09-04T10:42:44.000Z","size":21698,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-05T16:36:53.414Z","etag":null,"topics":["backend","coding-tests","expressjs","nodejs"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yeehanchung.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-06-20T11:25:46.000Z","updated_at":"2021-09-04T10:42:47.000Z","dependencies_parsed_at":null,"dependency_job_id":"f5c119d6-7598-4565-a4a1-7cf5609d9327","html_url":"https://github.com/yeehanchung/coding-test-express-nodejs","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/yeehanchung/coding-test-express-nodejs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yeehanchung%2Fcoding-test-express-nodejs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yeehanchung%2Fcoding-test-express-nodejs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yeehanchung%2Fcoding-test-express-nodejs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yeehanchung%2Fcoding-test-express-nodejs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yeehanchung","download_url":"https://codeload.github.com/yeehanchung/coding-test-express-nodejs/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yeehanchung%2Fcoding-test-express-nodejs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31682953,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-11T13:07:20.380Z","status":"ssl_error","status_checked_at":"2026-04-11T13:06:47.903Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["backend","coding-tests","expressjs","nodejs"],"created_at":"2024-11-15T16:31:52.543Z","updated_at":"2026-04-11T13:34:47.490Z","avatar_url":"https://github.com/yeehanchung.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ❗️ Disclaimer\n\nThis is a backend coding test I passed with 100% in April 2021 for a full-time position as a **junior full-stack developer** in a Singapore startup company, and lastly received a job offer which I'm grateful for to potentially kickstart my career just after my internship. I really enjoyed this coding test so much, and learned new cool stuff within 4 hours given.\n\nThis repository contains the **questions** and **complete solutions** in 2 separate folders:\n\n- `backend-coding-test`\n- `backend-coding-test-complete`\n\n### ⚙️ How did I solve?\n\n- Googling skills\n- Good fundamental knowledge of Node.js from recent internship\n- Make use of 3rd-party libraries for solving API-related challenges\n- Interest and the drive in full-stack web development\n\n### 📔 Things I learned\n\n- Cleaner codes\n- Explored new libraries: `moment`, `sqlite3`, `supertest`\n- Problem-solving skills\n- Design patterns\n\n\u003e At last, I didn't decide to join the company and stay in Malaysia despite the fact that the compensation is great for a junior like me, but I'm very thankful for every opportunities I received.\n\n---\n\nFeel free to clone and practice **Express.js backend web development**.\n\nHappy coding! 🧘‍♂️\n\n# 🚀 Running the project\n\nTo run the project:\n  * Clone the git repository\n  * Install necessary modules using `npm install`\n  * Run the project using `npm start`\n  * To run the tests, use `npm run test`\n\n---\n\n# ❓ Problem Description\n\nSome number of travellers  chooses to pay for airplane tickets on one of our travel partner's websites using Split.\n\n\nWhile we make sure we get the periodic payments from the travellers, your job is to reimburse the travel partner the full amount paid for the tickets purchased in a certain date range on a specific day of the week.\n\n​\nWe reimburse our travel partners periodically **once** or **twice** per week, depending on our business agreement with them.\n​\nIf the agreement is **once per week**, we pay them on each **Monday**. If the agreement is **twice per week**, we pay them either on the next **Monday** or **Thursday**, whichever comes first.\n\nTo sum up:\n  * For a travel partner we reimburse **Once per week**, all tickets purchased from **Monday** to **Sunday** should be reimbursed on the following **Monday**.\n  * For a travel partner we reimburse **Twice per week**, all tickets purchased from **Monday** to **Wednesday** should be paid on the following **Thursday**. Tickets purchased from **Tursday** to **Sunday** should be paid on the following **Monday**.\n\nThe amount of money reimbursed to a travel partner is calculated by summing up the purchased tickets in the date range, minus a transaction fee for each ticket. (Which is what makes us money, yay!)\n​\n# Assignment 1\nGiven a start date and an end date, complete the two API endpoints for once-per-week partners and twice-per-week partners so that they return the correct reimbursement date. \n\nThe endpoints can be found in `tickets.js.` and are called from `http://localhost:3000/tickets/oneSettlementPerWeek` and `http://localhost:3000/tickets/twoSettlementPerWeek` respectively.\n\nExtra tip: `moment.js` is a nice JavaScript library to manipulate datetimes. It is included in `tickets.js`\n​\n## Example Input \u0026 Output\nFor a travel partner on **one payment per week**:\n\nInput date range of **03-02-2020 to 05-02-2020**, next upcoming payment date will be **10-02-2020**\n\nInput date range of **03-02-2020 to 06-02-2020**, next upcoming payment date will be **10-02-2020**\n\nInput date range of **03-02-2020 to 10-02-2020**, next upcoming payment date will be **17-02-2020**\n\n\nFor a travel partner on **two payment per week**:\n\nInput date range of **03-02-2020 to 05-02-2020**, next upcoming payment date will be **06-02-2020**\n\nInput date range of **03-02-2020 to 06-02-2020**, next upcoming payment date will be **10-02-2020**\n\nInput date range of **03-02-2020 to 07-02-2020**, next upcoming payment date will be **10-02-2020**\n\n​\n\n  \n# Assignment 2\nGiven an array of ticket objects, complete the API endpoint `http://localhost:3000/tickets/calculateSettlementAmount` (Again in `tickets.js`) to calculate the total reimbursement after the transaction fee deduction. \n\nThe transaction fee is specified in whole percentages.\n\nThe final total calculated reimbursement should be in two decimals points and always rounded up.\n\n## Example Input \u0026 Output\n`MDR = Merchant Discount Rate = The transaction fee in whole percentages`\n\n``` \n//array of tickets \n[\n  {\n    \"ticketId\": \"TE231023-23\",\n    \"price\" : 100,\n    \"MDR\" : 2.33\n  },\n  {\n    \"ticketId\": \"KE23D0S3-J3\",\n    \"price\" : 231,\n    \"MDR\" : 5.34\n  },\n  {\n    \"ticketId\": \"LDL40S3-U3\",\n    \"price\" : 659,\n    \"MDR\" : 6.31 \n  }\n] \n``` \nFor the above tickets, the result should be `(100 * (1 - 0.0233)) + (231 * (1 - 0.0534)) + (659 * (1 - 0.0631)) = 933.7517 = (always rounded up) 933.76`.\n\nFor rounding, if the computed total sum is 35.12356, the rounded up computed sum will be 35.13\n\nIf the computed total sum is 35.9926, the rouded up computed sum will be 36.00\n\n\n# Assignment 3\nCreate 4 Restful API endpoints GET,POST,PUT,DELETE for tickets\n\nUse NPM sqlite3 save the tickets https://www.npmjs.com/package/sqlite3\n\nData structure of ticket\n```\n{\n  \"ticketId\":\"TES2312-32\",\n  \"price\" , \"203.10\",\n  \"MDR\" : \"2.0\",\n  \"currency\" : \"SGD\",\n  \"travelAgentName\" : \"SPLIT-TEST-AGENT01\"\n}\n\n```\n\nWrite test cases for the APIs you created\n\n# Assignment 4\n\nAPI route tickets/crashApp will cause the app process to crash\n\nProvide a solution to restart the app instance if it crashes. \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyeehanchung%2Fcoding-test-express-nodejs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyeehanchung%2Fcoding-test-express-nodejs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyeehanchung%2Fcoding-test-express-nodejs/lists"}