Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeScript Definition #3

Open
JoeChapman opened this issue Dec 10, 2020 · 1 comment
Open

TypeScript Definition #3

JoeChapman opened this issue Dec 10, 2020 · 1 comment

Comments

@JoeChapman
Copy link
Contributor

Add a TypeScript Definition file

@elisherer
Copy link

This works for me...

Create a file src/@types/api-express-reporter.d.ts:

module "api-express-exporter" {
  type ApiExpressExporterOptions = {
    /** host string for the metrics server. Defaults to 127.0.0.1 */
    host?: string;
    /** port that metrics server listens on. Defaults to 9991 */
    port?: number;
    /** function to create the url pattern matcher, defaults to (path) => new UrlPattern(path, { segmentNameCharset: "a-zA-Z0-9_-" }) */
    urlPatternMaker?: (path: string) => any;
    /** Set this to false to use the original url instead of cleaned up ones. */
    normalizePath?: boolean;
    /** Set this to false to not create the exporter server endpoint */
    createServer?: boolean;
    /** Use this to pass in a custom logger function. Useful when you're using pino, bunyan, winston, or another custom logger. Defaults to console.log */
    logger?: typeof console.log;

    discardUnmatched?: boolean;
  };

  export default function makeApiMiddleware(options?: ApiExpressExporterOptions): any;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants