Product Catalog

Build Status MIT Licence

Getting Started

Start by cloning the repository using: git clone https://github.com/IamRaviTejaG/product-catalog.git followed by cd product-catalog.

Install all the dependencies (including the dev dependencies) using the npm install or npm i command. Once the dependencies are installed, use npm start to start the server.

Use an API testing tool like Postman or Insomnia to send/receive HTTP requests.

Dependencies & Packages

Developer dependencies:

Running locally

The .env file

The .env file holds the important variables for the whole application which include the database URL, database port, application port, etc.

NOTE: When running tests, make sure to point the MONGO_URL at the test database to avoid garbage collection in the main database.

npm scripts

The package.json file contains five scripts for running locally: linter, test, coverage, build & start.

Runs the StandardJS linter along with the --fix flag, which lints code to a great extent. The traceback (if one shows up) is the list of errors that need to be fixed manually.

Runs only the tests.

Runs the test coverage & shows up detailed report.

Builds the project.

First builds and then starts the server.

API endpoints

1. /insert

Request type: POST
Data parameters: name, category, brandName, images

2. /search

2.1. By name (/search/name/:searchQuery)
Request type: GET
Data parameters: name
2.2. By brandName (/search/brand/:searchQuery)
Request type: GET
Data parameters: brandname
2.3. By category (/search/category/:searchQuery)
Request type: GET
Data parameters: category

3. /update

3.1. By id (/update/byId/:id)
Request type: PUT
Data parameters: newName, newCategory, newBrandName, newImages
3.2. By name (/update/byName/:name)
Request type: PUT
Data parameters: newName, newCategory, newBrandName, newImages

4. /delete

4.1. By name (/delete/:name)
Request type: GET
Data parameters: name

© 2019 Ravi Teja Gannavarapu