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
8 changes: 7 additions & 1 deletion src/content/api/4x/api/application/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -1286,7 +1286,7 @@ app.put('/', function (req: Request, res: Response) {
<Signature>
<Fragment slot="attributes">
<Param name="view" type="String">
The name of the view to render.
The file path of the view to render (absolute or relative to the `views` setting).
</Param>
<Param name="locals" type="Object" optional>
An object whose properties define local variables for the view.
Expand All @@ -1301,6 +1301,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()](/api/response/#resrender),
except it cannot send the rendered view to the client on its own.

The `view` argument is resolved the same way as [res.render()](/api/response/#resrender). It can be
an absolute path, or a path relative to the `views` setting. If the path does not include an
extension, Express uses the `view engine` setting to determine the template file extension. For
example, with `app.set('views', './views')` and `app.set('view engine', 'pug')`, `app.render('email')`
renders the template at `views/email.pug`.

<Alert type="info">

Think of `app.render()` as a utility function for generating rendered view strings. Internally
Expand Down
8 changes: 7 additions & 1 deletion src/content/api/5x/api/application/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -1195,7 +1195,7 @@ app.query('/search', (req: Request, res: Response) => {
<Signature>
<Fragment slot="attributes">
<Param name="view" type="String">
The name of the view to render.
The file path of the view to render (absolute or relative to the `views` setting).
</Param>
<Param name="locals" type="Object" optional>
An object whose properties define local variables for the view.
Expand All @@ -1210,6 +1210,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()](/api/response/#resrender),
except it cannot send the rendered view to the client on its own.

The `view` argument is resolved the same way as [res.render()](/api/response/#resrender). It can be
an absolute path, or a path relative to the `views` setting. If the path does not include an
extension, Express uses the `view engine` setting to determine the template file extension. For
example, with `app.set('views', './views')` and `app.set('view engine', 'pug')`, `app.render('email')`
renders the template at `views/email.pug`.

<Alert type="info">

Think of `app.render()` as a utility function for generating rendered view strings. Internally
Expand Down
Loading