You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Unsure if this is a bug report or a feature request, I've gone with the latter as this seems to be unimplemented behavior.
In express, res.locals are a per-request equivalent to app.locals, and the property is mentioned here in tinyhttp:
However, res.locals's behavior isn't present, as it doesn't seem to be used in renderTemplate, and they won't be available within templates:
import{App}from"@tinyhttp/app";import{renderFileaseta}from"eta";constapp=newApp();app.engine("eta",eta);app.use(function(req,res,next){res.locals.hello="hello world!";next();});app.get((req,res)=>res.render("index.eta"));app.listen(3000,()=>console.log("Listening on port 3000"));
Describe alternatives you've considered
I could manually use res.locals with res.render or use a function to automate this, but it would be more convienent to have res.locals's expected behavior, as doing so somewhat defeats the point of res.locals
Is your feature request related to a problem? Please describe.
Unsure if this is a bug report or a feature request, I've gone with the latter as this seems to be unimplemented behavior.
In express, res.locals are a per-request equivalent to app.locals, and the property is mentioned here in tinyhttp:
tinyhttp/packages/app/src/response.ts
Line 47 in 072e75f
However, res.locals's behavior isn't present, as it doesn't seem to be used in renderTemplate, and they won't be available within templates:
views/index.eta
Describe the solution you'd like
Matching express's res.locals behavior, described here: https://expressjs.com/en/api.html#res.locals
Describe alternatives you've considered
I could manually use res.locals with res.render or use a function to automate this, but it would be more convienent to have res.locals's expected behavior, as doing so somewhat defeats the point of res.locals
The text was updated successfully, but these errors were encountered: