Skip to content
Merged
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .github/workflows/update-external-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -132,5 +132,5 @@ jobs:
title: 'i18n: new crowdin translations'
body: >
New Crowdin translations from the [express.js crowdin project](https://express.crowdin.com/u/projects/1). cc: @expressjs/docs-wg
labels: docs
labels: i18n
branch: crowdin/translations
43 changes: 0 additions & 43 deletions src/content/docs/de/4x/advanced/developing-template-engines.md

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,31 @@ app.set('views', './views'); // specify the views directory
app.set('view engine', 'ntl'); // register the template engine
```

```ts
import fs from 'fs'; // this engine requires the fs module
app.engine(
'ntl',
(
filePath: string,
options: Record<string, any>,
callback: (e: any, rendered?: string) => void
) => {
// define the template engine
fs.readFile(filePath, (err, content) => {
if (err) return callback(err);
// this is an extremely simple template engine
const rendered = content
.toString()
.replace('#title#', `<title>${options.title}</title>`)
.replace('#message#', `<h1>${options.message}</h1>`);
return callback(null, rendered);
});
}
);
app.set('views', './views'); // specify the views directory
app.set('view engine', 'ntl'); // register the template engine
```

Your app will now be able to render `.ntl` files. Create a file named `index.ntl` in the `views` directory with the following content.

```pug
Expand Down
12 changes: 10 additions & 2 deletions src/content/docs/de/4x/guide/behind-proxies.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,14 @@ app.set('trust proxy', (ip) => {
});
```

```ts
app.set('trust proxy', (ip: string) => {
if (ip === '127.0.0.1' || ip === '123.123.123.123')
return true; // trusted IPs
else return false;
});
```

</td>
</tr>
</tbody>
Expand All @@ -91,8 +99,8 @@ Das Aktivieren von `trust proxy` hat folgende Auswirkungen:
</li>
<li markdown="1">
`X-Forwarded-Proto` kann vom Reverse Proxy gesetzt werden, um der App mitzuteilen, ob es `https`
oder `http` oder sogar ein ungültiger Name ist. Dieser Wert wird von [req.protocol]reflektiert
(/en/api#req.protocol).
oder `http` oder sogar ein ungültiger Name ist. This value is reflected by
[req.protocol](/api/request/#reqprotocol).
</li>
<li markdown="1">
Die Werte [req.ip](/api#req.ip) und [req.ips](/api#req.ips) werden auf der Basis der
Expand Down
Loading
Loading