i18next / i18next-http-middleware

i18next-http-middleware is a middleware to be used with Node.js web frameworks like express or Fastify and also for Deno.
MIT License
150 stars 28 forks source link

Allow fastify hook to be on preValidation (configurable) request hook. #67

Closed remidewitte closed 6 months ago

remidewitte commented 6 months ago

https://github.com/i18next/i18next-http-middleware/blob/90f5a482db84ea8597b9d743e1ce6f0018323ee2/lib/index.js#L122

Use-case :

Hook could be changed to : 'preValidation' It could also be configurable when the plugin is registered.

adrai commented 6 months ago

You should be able to use the 'preValidation' hook like here: https://github.com/i18next/i18next-http-middleware/blob/master/example/fastify/index.js#L28

Regarding the plugin usage, feel free to suggest a PR.

remidewitte commented 6 months ago

@adrai Many thanks for your answer. I did not notice the alternative usage with addHook that shall work indeed.

I am happy to suggest a PR if the addHook does not work.