Giter Site home page Giter Site logo

sample-search's Introduction

Setup

  • npm install
  • npm start - will bring up both client and server
  • npm build - stores minified build artifact in builds/prod
  • npm build-dev - stores build artifacts in builds/dev with sourcemaps
  • npm test - will run jest tests.

linting code

  • Added eslint and prettier plugin and .eslintrc.js
  • Also added to .vscode/settings.json for code formatting on save.

Tests

  • jest tests were written for testing of Caching of Search Results
  • provided postman collections(server/postman) for testing node backend.
  • did not write cypress tests due to time.
  • did not have at least 85% test coverage due to time.

Webpack

  • replaced gulpfile
  • allow for webpack use and builds in different environments
  • added webpack-dev-server for automatic reloading for changes and openning of webpage
  • separating files like scss, js, images.
  • prod mode defaults to minifying builds
  • npm start brings up both services for client and server.

Environment

  • configured in .env
  • I commented out .gitignore so that you can bring up application. This file should usually not be included in pkg and should be private.
  • did not implement docker due to time.

Search Hashmap

  • used closure on backend to store product keys and values on startup
  • keys are stored to handle single digit searches or queries
  • test was written for this
  • if data is larger I would explore the use of tries data structure similar to Google search.

State Management

  • I chose NOT to use Redux(ReduxToolkit) and Redux Saga because they are commonly used in most companies but is kinda overkill for this small project. Also global state is bad. It doesnt promote encapsulation of properties.
  • For large apps and different developers Redux provides a global state or a common store to keep track of changes using devtools. This is extremely useful for debugging, but not good for component based development(as stated in prev statement)
  • I used React.Context to reduce the prop drilling. Also created a custom useFetch hook to work with useContext

Styles

  • I used styled-components to prevent css selector conflicts in the future.
  • I did not have time to make it responsive.

API

Use Cases


1. load home page after npm start

Screen Shot 2023-04-28 at 11 55 50 PM


2. select magnifier glass on far right corner will show searchbar.

image


3. single character like 'd' on search bar will show 4 different types of products.

image


4. Two ways you can go to display page and show Product Carousel:

  1. Click See all Results link will send you the carousel of products on display page.
  2. You can press return on search bar. image

5. Product Carousel

image


6. click ELC icon on the top left corner on the navbar will bring you back to home page.

sample-search

sample-search's People

Contributors

simple-sifu avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.