Is this singleton insecure in production? #2062
-
I've read that singleton in i18next might lead to problems in production, not sure if I understood it well.
Is this code insecure in production? I've read "singleton" might cause troubles with concurrency, and overriding languages. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
As long you only use the There is also https://github.com/i18next/i18next-http-middleware so there is no need to create this stuff yourself |
Beta Was this translation helpful? Give feedback.
As long you only use the
req.t
that you set - you should be fine. The problem only arises when you directly use i18next.t -> which could be set to any language the last incoming request set - while your pending requests still rely on other languages.There is also https://github.com/i18next/i18next-http-middleware so there is no need to create this stuff yourself