Skip to content

Provide method to add to template locals #42

@adrianbrowning

Description

@adrianbrowning

Hey, would be great to have req and res added to the arguments passed back through, when using the template as a function.

render(locals, function (err, body) {
        if (err) return next(err);

        var buf = new Buffer(body, 'utf8');
        res.setHeader('Content-Type', 'text/html; charset=utf-8');
        res.setHeader('Content-Length', buf.length);
        res.end(buf);
      });

So would look like:

render(locals, function (err, body) {
        if (err) return next(err);

        var buf = new Buffer(body, 'utf8');
        res.setHeader('Content-Type', 'text/html; charset=utf-8');
        res.setHeader('Content-Length', buf.length);
        res.end(buf);
      },req, res);

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions