product-categorization-engine-module
Module responsable for product categorization
Explore the docs
»
Table of Contents
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
- Clone the repo
git clone https://github.com/tiendamiaOfficial/backend-categorization-module.git
- 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
- Clone the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - 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
.