Simran_14 0 Newbie Poster

Hello everyone!
This question is related to using Sequelize with Node.js and MySQL. I have come across a small doubt and need your help.

To enable CLS with Sequelize we initialize a CLS namespace using the following lines of code:

const cls = require('continuation-local-storage');
const namespace = cls.createNamespace('custom-sequelize-namespace');
const Sequelize = require('sequelize');
Sequelize.useCLS(namespace);
const sequelize = new Sequelize(/* … */);

So my question is in which file do I have to add this code? index.js or all the model files?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.