-
-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Non-Express version? #186
Comments
Sorry for the late reply...this one got under the radar at some point...(I missed to reply instantly and forgot about it totally). I think there is not too much express specific things in this...and it should be not to hard to convert it to not depend on express. |
@jamuhl Since Express is a superset of normal HTTP interfaces, would you be open to changing the default i18next middleware to not rely on Express if we end up finding that this is possible? This change shouldn't affect users at all, as the config/API and behaviour would remain exactly the same. It would allow i18next to be used in serverless setups, and also allow Koa/Hapi users to use the middleware. |
sure that would be awesome...just we would have to rename this repo afterwards to some more general name...or create a new one and mark this obsolete with a link on the new one... |
@jamuhl Unless I've missed something, it was indeed quite simple. Do you have time to review #191? In general, I think the best approach is to create an entirely new repository and deprecate this one, but I will leave that up to you. I think renaming could cause confusion for users and may make upgrading kind of weird. |
@isaachinman looks ok to me...and yes I think we better take the way of creating a new repository / npm module and deprecate this one... Currently lack of a good idea for the name...i18next-node-http, i18next-node-middleware, i18next-middleware ?!?! |
I prefer |
i18next-http-middleware? |
there is i18next-php, i18next-net, ... so currently I am for adding node somewhere i18next-node-middleware let see if we get some suggestions until tomorrow - will then create a new repo |
|
Yes, Let's wait until the PR is mergeable, and then clone this repo into |
@isaachinman just created and added you as admin: https://github.com/i18next/i18next-node-middleware |
@iamjochem I have continued on my local branch, today. Express provides a powerful middleware concept, which to my knowledge is not available in vanilla HTTP provided by Nodes http library. The current approach is to use the connect library, which provides a middleware concept for http. After working on this for some time, I switched to next-i18next to see how this library gets integrated. Is my understanding correct that next-i18next uses the i18next-express-middleware but also others for locale subpath work? To me, it's quite confusing spreading middleware logic throughout several libraries. Another question is about custom servers, which, according to the Next developers, gets not supported in serverless deployment. I saw a lot of projects are deploying Express in their Next project. But what is the difference, implementing a server through Nodes http library is basically a server, too right. So the general question is - are sever deployments supported in a serverless development concept, or do we need to fetch resources like i18n files directly with Next? |
@gurkerl83 Please do not double post - it isn't helpful to anyone. To answer your questions:
The work that needs to be done here has nothing to do with |
@isaachinman perhaps this may help: https://github.com/i18next/i18next-http-middleware |
@isaachinman for sure 😉 |
@adrai Here's a PR on |
Hi @jamuhl - wanted to raise an issue (finally) for this long-standing desire.
Currently,
i18next-express-middleware
powers next-i18next and is a critical dep. The fact that we're relying on Express unfortunately means we're tied to a custom-Node-server type of setup.This prevents next-i18next and any other consumers from going serverless.
I wonder what, if any, features of Express are being used here that couldn't be relatively easily replaced by vanilla Node HTTP interfaces? If this package exported a middleware that did not rely on Express syntax/features, and consumed normal HTTP interfaces, it could be used not only in serverless applications, but also with other HTTP frameworks like Koa, Hapi, etc.
Let me know what you think. I am mostly interested in your opinion of how much work this would take. I am very happy to fork this repo and maintain a
i18next-node-middleware
sort of thing if necessary. But, I do believe that using vanilla interfaces is the best way forward to enable the most users possible.The text was updated successfully, but these errors were encountered: