Move details below example 2

This commit is contained in:
Cellaryllis
2022-07-12 10:18:11 +01:00
committed by GitHub
parent 7eae5d4b7f
commit c541824657

View File

@@ -142,22 +142,22 @@ promBundle.normalizePath = (req, opts) => {
};
```
For more details:
* [url-value-parser](https://www.npmjs.com/package/url-value-parser) - magic behind automatic path normalization
* [normalizePath.js](https://github.com/jochen-schweizer/express-prom-bundle/blob/master/src/normalizePath.js) - source code for path processing
#### Example 3 (return express route definition):
```javascript
app.use(promBundle(/* options? */));
promBundle.normalizePath = (req, opts) => {
// Return the path of the express route (i.e. /v1/member/:id or /v1/timer/automated/:userid/:timerid")
// Return the path of the express route (i.e. /v1/user/:id or /v1/timer/automated/:userid/:timerid")
return req.route?.path ?? "NULL";
};
```
For more details:
* [url-value-parser](https://www.npmjs.com/package/url-value-parser) - magic behind automatic path normalization
* [normalizePath.js](https://github.com/jochen-schweizer/express-prom-bundle/blob/master/src/normalizePath.js) - source code for path processing
## express example
setup std. metrics but exclude `up`-metric: