mirror of
https://github.com/BreizhHardware/express-prom-bundle.git
synced 2026-01-18 16:27:28 +01:00
Merge pull request #56 from Collaborne/pr/middleware-result
Declare that the metricsMiddleware is accessible on the bundle as well
This commit is contained in:
6
types/index.d.ts
vendored
6
types/index.d.ts
vendored
@@ -46,6 +46,10 @@ declare namespace express_prom_bundle {
|
||||
};
|
||||
}
|
||||
|
||||
interface Middleware extends RequestHandler {
|
||||
metricsMiddleware: RequestHandler;
|
||||
}
|
||||
|
||||
const normalizePath: NormalizePathFn;
|
||||
const normalizeStatusCode: NormalizeStatusCodeFn;
|
||||
|
||||
@@ -57,4 +61,4 @@ interface express_prom_bundle {
|
||||
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';
|
||||
|
||||
// $ExpectType RequestHandler
|
||||
// $ExpectType Middleware
|
||||
const middleware: RequestHandler = promBundle({ includeMethod: true });
|
||||
|
||||
// $ExpectType: string
|
||||
@@ -11,7 +11,7 @@ middleware.name;
|
||||
|
||||
promClient.register.clear();
|
||||
|
||||
// $ExpectType RequestHandler
|
||||
// $ExpectType Middleware
|
||||
promBundle({
|
||||
normalizePath: [
|
||||
// collect paths like "/customer/johnbobson" as just one "/custom/#name"
|
||||
@@ -30,7 +30,7 @@ promBundle({
|
||||
|
||||
promClient.register.clear();
|
||||
|
||||
// $ExpectType RequestHandler
|
||||
// $ExpectType Middleware
|
||||
promBundle({
|
||||
buckets: [0.1, 0.4, 0.7],
|
||||
includeMethod: true,
|
||||
|
||||
Reference in New Issue
Block a user