Skip to content

YongYuH/SCMP-Article-Search

Repository files navigation

ezgif-6-56e909fc3d7b

How to run this repo in local development

  1. install yarn
  2. install dependencies through yarn
yarn
  1. open 2 terminal session, run front-end dev server and back-end dev server at the same time
  • run front end dev server
yarn dev
  • run back end dev server
yarn backend
  1. the front end dev server would be running on http://localhost:3000, and the back end dev server would be running on http://localhost:3001

Implementation Description

  • serve static files in front end fastify server
  • run api server with fastify
  • css in js: choose @emotion/styled to style components to avoid css classname naming collision and polyfill styled cross different browsers.
  • fetch data with feature of cache by swr
  • debounce user input to avoid too much api requests

Assumptions

  • search results of topics is the union of topics in data list
  • search panel only takes input event, click event would not trigger query

License

MIT