mirror of
https://github.com/BreizhHardware/express-prom-bundle.git
synced 2026-03-18 21:30:38 +01:00
Declare that the metricsMiddleware is accessible on the bundle as well
Related-to: #49
This commit is contained in:
6
types/index.d.ts
vendored
6
types/index.d.ts
vendored
@@ -44,6 +44,10 @@ declare namespace express_prom_bundle {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface Middleware extends RequestHandler {
|
||||||
|
metricsMiddleware: RequestHandler;
|
||||||
|
}
|
||||||
|
|
||||||
const normalizePath: NormalizePathFn;
|
const normalizePath: NormalizePathFn;
|
||||||
const normalizeStatusCode: NormalizeStatusCodeFn;
|
const normalizeStatusCode: NormalizeStatusCodeFn;
|
||||||
|
|
||||||
@@ -55,4 +59,4 @@ interface express_prom_bundle {
|
|||||||
normalizeStatusCode: express_prom_bundle.NormalizeStatusCodeFn;
|
normalizeStatusCode: express_prom_bundle.NormalizeStatusCodeFn;
|
||||||
}
|
}
|
||||||
|
|
||||||
declare function express_prom_bundle(opts: express_prom_bundle.Opts): RequestHandler;
|
declare function express_prom_bundle(opts: express_prom_bundle.Opts): express_prom_bundle.Middleware;
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import * as promClient from 'prom-client';
|
|||||||
|
|
||||||
import * as promBundle from 'express-prom-bundle';
|
import * as promBundle from 'express-prom-bundle';
|
||||||
|
|
||||||
// $ExpectType RequestHandler
|
// $ExpectType Middleware
|
||||||
const middleware: RequestHandler = promBundle({ includeMethod: true });
|
const middleware: RequestHandler = promBundle({ includeMethod: true });
|
||||||
|
|
||||||
// $ExpectType: string
|
// $ExpectType: string
|
||||||
@@ -11,7 +11,7 @@ middleware.name;
|
|||||||
|
|
||||||
promClient.register.clear();
|
promClient.register.clear();
|
||||||
|
|
||||||
// $ExpectType RequestHandler
|
// $ExpectType Middleware
|
||||||
promBundle({
|
promBundle({
|
||||||
normalizePath: [
|
normalizePath: [
|
||||||
// collect paths like "/customer/johnbobson" as just one "/custom/#name"
|
// collect paths like "/customer/johnbobson" as just one "/custom/#name"
|
||||||
@@ -30,7 +30,7 @@ promBundle({
|
|||||||
|
|
||||||
promClient.register.clear();
|
promClient.register.clear();
|
||||||
|
|
||||||
// $ExpectType RequestHandler
|
// $ExpectType Middleware
|
||||||
promBundle({
|
promBundle({
|
||||||
buckets: [0.1, 0.4, 0.7],
|
buckets: [0.1, 0.4, 0.7],
|
||||||
includeMethod: true,
|
includeMethod: true,
|
||||||
|
|||||||
Reference in New Issue
Block a user