Tavanogui
Tavanogui6mo ago

How can I access req object inside a render() function from fresh plugin?

Is it possible?
6 Replies
razzi
razzi6mo ago
I'd get what you need from the request and put it in app state, then pass the relevant app state thru to the render Could you add some more information like the fresh plugin so we can get a better idea of the use case?
lucis
lucis6mo ago
We're using the plugin as a gateway to attach the string translations to the web page, so that it can be used by both backend and frontend code A better i18n approach would be cool as well, haven't looked into that for a while
Tavanogui
Tavanogui6mo ago
yes, we would like to listen popular approachs for i18n but, in general line we are doing something like:
Tavanogui
Tavanogui6mo ago
No description
marvinh.
marvinh.6mo ago
I think we're missing that in our API. I feel like we should change it so that the ctx object should match other areas of the plugin API Filed https://github.com/denoland/fresh/issues/2220 so that we don't forget about it. (It's difficult for me to keep track of bug reports or feature requests in discord compared to github)
Tavanogui
Tavanogui6mo ago
nice! started something here: https://github.com/denoland/fresh/pull/2224
More Posts