@types/response-time
@types/response-time
npm i @types/response-time
@types/response-time

@types/response-time

The repository for high quality TypeScript type definitions.

by DefinitelyTyped

2.3.5 (see all)License:MITTypeScript:Built-In
npm i @types/response-time
Readme

Installation

npm install --save @types/response-time

Summary

This package contains type definitions for response-time (https://github.com/expressjs/response-time).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/response-time.

index.d.ts

// Type definitions for response-time 2.3.2
// Project: https://github.com/expressjs/response-time
// Definitions by: Uros Smolnik <https://github.com/urossmolnik>, TonyYang <https://github.com/TonyPythoneer>
//                 Dan Manastireanu <https://github.com/danmana>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3


/* =================== USAGE ===================

    import responseTime = require('response-time');
    app.use(responseTime());

 =============================================== */


/// <reference types="node" />


import http = require("http");
import express = require("express");


export = responseTime;

/**
 * Response time header for node.js
 * Returns middleware that adds a X-Response-Time header to responses.
 */
declare function responseTime(options?: responseTime.ResponseTimeOptions):
    (request: http.IncomingMessage, response: http.ServerResponse, callback: (err: any) => void) => any;
declare function responseTime(fn: responseTime.ResponseTimeFunction):
    (request: http.IncomingMessage, response: http.ServerResponse, callback: (err: any) => void) => any;
declare function responseTime(fn: (request: express.Request, response: express.Response, time: number) => any):
    express.RequestHandler;


declare namespace responseTime {
    export interface ResponseTimeOptions {
        digits?: number | undefined;
        header?: string | undefined;
        suffix?: boolean | undefined;
    }

    export interface ResponseTimeFunction {
        (request: http.IncomingMessage, response: http.ServerResponse, time: number ): any;
    }
}

Additional Details

Credits

These definitions were written by Uros Smolnik, TonyYang, and Dan Manastireanu.

Downloads/wk

44.3K

GitHub Stars

40.9K

LAST COMMIT

7mos ago

MAINTAINERS

1

CONTRIBUTORS

17,572

OPEN ISSUES

635

OPEN PRs

204
VersionTagPublished
2.3.5
latest
1yr ago
2.3.5
ts4.7
1yr ago
2.3.5
ts4.6
1yr ago
2.3.5
ts4.8
1yr ago
No alternatives found
No tutorials found
Add a tutorial

Rate & Review

100
No reviews found
Be the first to rate