The product is live at Heroku.
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.
body-parser
dotenv
express
mongoose
morgan
Developer dependencies:
@babel/cli
@babel/core
(Transpiling ES6 code for use with NodeJS)@babel/present-env
@babel/register
chai
(Assertion)mocha
(Testing)nyc
(Test coverage)request
request-promise
(For sending HTTP requests to the server while testing)rimraf
(The UNIX rm -rf command for Node)standard
(Linting)
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.
The package.json
file contains five scripts for running locally: linter
, test
, coverage
, build
& start
.
"linter": "standard --fix"
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.
"test": "mocha --require @babel/register --timeout 5000 --exit"
Runs only the tests.
"coverage": "nyc --reporter=text mocha --require @babel/register --timeout 5000 --exit"
Runs the test coverage & shows up detailed report.
"build": "rimraf dist/ && babel ./ --out-dir dist/ --copy-files"
Builds the project.
"start": "npm run build && node dist/index.js --no-deprecation"
First builds and then starts the server.
Request type: POST
Data parameters: name, category, brandName, images
Request type: GET
Data parameters: name
Request type: GET
Data parameters: brandname
Request type: GET
Data parameters: category
Request type: PUT
Data parameters: newName, newCategory, newBrandName, newImages
Request type: PUT
Data parameters: newName, newCategory, newBrandName, newImages
Request type: GET
Data parameters: name