0.1.1-beta.2 • Published 3 years ago

product-categorization-engine-module v0.1.1-beta.2

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years ago

About The Project

Module for backend of categorization tools, this module has tu be installed in backend-backoffice

Built With

BD Diagram

Getting Started

To get a local copy up and running follow these simple steps.

Prerequisites

This is an example of how to list things you need to use the software and how to install them.

  • npm
    npm install npm@latest -g

Installation

  1. Clone the repo
    git clone https://github.com/tiendamiaOfficial/backend-categorization-module.git
  2. Install NPM packages
    npm install

Usage

How to use logs with winston

 logger.error(err);
 logger.info(err);

How to set connection or configurations params

all configurations should be set in .env file , example

 # Put lots of randomness in these
 SESSION_SECRET=ashdfjhasdlkjfhalksdjhflak

the project has the module dotenv-flow it allow to have a .env file for each environment overriding .env property in each child

 .env.local
 .env.test
 .env.staging
 .env.production

you can execute node comand using the enviroment and each enviroment has a .env file example "NODE_ENV=test jest --forceExit --coverage --verbose"

How to connect to database

Connection to database are handler in a single service dbConnection, that service has methods like: connect() and close().

The database connection params is configured in .env file

How to use dependency injection

For consuming service injected in dependency injection.

const VAR_NAME = container.get<NAME_OF_SERVICE>(TYPES.NAME_OF_SERVICE);

For inject service on the dependency injection system

Add on /lib/ContainerInjection.ts the next code.

container.bind<NAME_OF_SERVICE>(TYPES.DbConnection).to(NAME_OF_SERVICE);

and add on /lib/Types.ts

const TYPES = {
    NAME_OF_SERVICE: Symbol.for('NAME_OF_SERVICE'),
};

Contributing

  1. Clone the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Publish module

Publish

1 - Open the terminal and run the next command npm login and login with tiendamiadev credentials.

2 - Publish package npm publish --access restricted.