Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions _includes/api/en/3x/app-render.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ Render a `view` with a callback responding with
the rendered string. This is the app-level variant of `res.render()`,
and otherwise behaves the same way.

The `view` argument can be an absolute path or a path relative to the `views` setting.
If the path does not contain a file extension, then the `view engine` setting determines
the file extension. For example, with `app.set('views', './views')` and
`app.set('view engine', 'pug')`, `app.render('email', ...)` renders `./views/email.pug`.

```js
app.render('email', function (err, html) {
// ...
Expand Down
6 changes: 6 additions & 0 deletions _includes/api/en/4x/app-render.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ Returns the rendered HTML of a view via the `callback` function. It accepts an o
that is an object containing local variables for the view. It is like [res.render()](#res.render),
except it cannot send the rendered view to the client on its own.

The `view` argument is resolved the same way as in [res.render()](#res.render): it can
be an absolute path or a path relative to the `views` setting. If the path does not
contain a file extension, then the `view engine` setting determines the file extension.
For example, with `app.set('views', './views')` and `app.set('view engine', 'pug')`,
`app.render('email', ...)` renders `./views/email.pug`.

<div class="doc-box doc-info" markdown="1">
Think of `app.render()` as a utility function for generating rendered view strings.
Internally `res.render()` uses `app.render()` to render views.
Expand Down
6 changes: 6 additions & 0 deletions _includes/api/en/5x/app-render.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ Returns the rendered HTML of a view via the `callback` function. It accepts an o
that is an object containing local variables for the view. It is like [res.render()](#res.render),
except it cannot send the rendered view to the client on its own.

The `view` argument is resolved the same way as in [res.render()](#res.render): it can
be an absolute path or a path relative to the `views` setting. If the path does not
contain a file extension, then the `view engine` setting determines the file extension.
For example, with `app.set('views', './views')` and `app.set('view engine', 'pug')`,
`app.render('email', ...)` renders `./views/email.pug`.

<div class="doc-box doc-info" markdown="1">
Think of `app.render()` as a utility function for generating rendered view strings.
Internally `res.render()` uses `app.render()` to render views.
Expand Down
Loading