Skip to content

tylerlianghuang/typescript-code-challenge

 
 

Repository files navigation

Typescript Challenge

Quick Demo

Happy scenario GIF

Invalid path GIF

MongoDB CUSTOMERS collection snapshot

MongoDB ORDERS collection snapshot

How to run

This is a Next.js responsive project bootstrapped with create-next-app and uses MongoDB Atlas for the datastore.

First, run the development server:

npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev

Open http://localhost:3000 with your browser to see the result.

Run the Jest test:

npm run test

Run the Cypress test:

npm run test:cypress

Run the Cypress test with the LaunchPad:

npm run test:cypress:open

Troubleshoot

  1. MongoDB connection timeout issue.
  • It should be related to IP whitelisting. I have given access to all IPs and tested on a different machine with Mobile hotspot. If problem persists, maybe have a look local etc/hosts or other local config files.
MongoDB IP setting

TypeScript Challenge Instructions

Instructions

Write a Node project that:

  1. reads in the file data.json transforms it into a format that matches example-output.json
  2. load transformed data into a datastore - store can be of your choice, in memory or a local database
  3. Create an API that has 2 get API calls. One for customers and one for orders that pull data from the datastore
  4. Create a simple UI that calls the API and displays the customer and the customers orders

General Approach and Assumptions

  • Solution should be implemetned in TypeScript.
  • Read JSON data.json async from it's directory, convert data async, write into datastore async
  • Solution should be run from the command line using npm run.
  • Solution should be non-blocking.
  • Solution should use React or modern equivilent for UI
  • Solution APIs should be REST compliant

Criteria

Your work will be evaluated primarily on:

  • Consistency of coding style.
  • Correct use of promises, including proper error handling.
  • Correct use of TypeScript, including interface/object definitions.
  • Absence of "callback hell".
  • Correct and complete unit test coverage.
  • General quality of code and technical communication.

How to submit your work

  1. Fork this project on github.
  2. Update this README.md file with instructions on how to build/test/run your script.
  3. When you're finished, send us the URL of your public repository.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 92.3%
  • JavaScript 7.7%