Sticky session enabling in nest js

140 Views Asked by At

const httpServer = http.createServer();

// setup sticky sessions setupMaster(httpServer, { loadBalancingMethod: "least-connection", });

How to enable sticky sessions ,similar to node in nest js .

Nest js is framework is it possible to enable sticky session for clustering.

1

There are 1 best solutions below

0
Mardin On

You can use sticky-session library for this purpose.

// Replace 'httpServer' with the server instance you want to use (e.g., Express)
sticky.listen(httpServer, 3000, () => {
  console.log('Server started on port 3000');
});