Skip to content

wojciechszmelczerczyk/js-ecommerce-data-fetch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

E-commerce data fetching

Description

Software which fetch e-commerce like data and perform logic on it.

Table of contents

Techstack

  • JavaScript

Prerequisities

  • Node.js

Libraries

API

Table below presents functions which are responsible for data fetching from REST API.

Resources is only name convention here to generalize usage of an API endpoints.

You can click specific endpoint in order to get more in-depth information about usage.

Additionally you can click function in order to check implementation.

Method Endpoints Function
GET /resources getAll
GET /resources/:id getOne

Utils

Table below shows util functions which perform logic on data fetched from an API.

Function
Aggregate prices by category
Highest cart value
Furthest distance between users

To run

Clone repository.

git clone https://github.com/wojciechszmelczerczyk/js-ecommerce-data-fetch.git

Navigate to project root directory.

cd ./js-ecommerce-data-fetch

Install dependencies.

npm i

Create following .env file in project root directory.

BASE_URL=https://fakestoreapi.com

CARTS_URL=carts
PRODUCTS_URL=products
USERS_URL=users

CARTS_DATE_QUERY_STR=?startdate=2000-01-01&enddate=2023-04-07

Project use CommonJS syntax, so export is not supported. Please change node_modules/geolocation-distance-between/lib/index.js line 54 from export to module.exports =.

Run server.

npm run start

Tests

Table below represents docs for unit tests.

Unit tests
getAll
getOne

To run

Run tests.

npm run test

About

Fetch e-commerce like data application.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published