Initial commit

This commit is contained in:
abrendan
2023-11-30 14:15:19 +00:00
commit e4599df811
5457 changed files with 500139 additions and 0 deletions

50
node_modules/response-time/HISTORY.md generated vendored Normal file
View File

@@ -0,0 +1,50 @@
2.3.2 / 2015-11-15
==================
* deps: depd@~1.1.0
- Enable strict mode in more places
- Support web browser loading
* deps: on-headers@~1.0.1
- perf: enable strict mode
* perf: enable strict mode
2.3.1 / 2015-05-14
==================
* deps: depd@~1.0.1
2.3.0 / 2015-02-15
==================
* Add function argument to support recording of response time
2.2.0 / 2014-09-22
==================
* Add `suffix` option
* deps: depd@~1.0.0
2.1.0 / 2014-09-16
==================
* Add `header` option for custom header name
* Change `digits` argument to an `options` argument
2.0.1 / 2014-08-10
==================
* deps: on-headers@~1.0.0
2.0.0 / 2014-05-31
==================
* add `digits` argument
* do not override existing `X-Response-Time` header
* timer not subject to clock drift
* timer resolution down to nanoseconds
* use `on-headers` module
1.0.0 / 2014-02-08
==================
* Genesis from `connect`

23
node_modules/response-time/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,23 @@
(The MIT License)
Copyright (c) 2014 Jonathan Ong <me@jongleberry.com>
Copyright (c) 2014-2015 Douglas Christopher Wilson <doug@somethingdoug.com>
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

137
node_modules/response-time/README.md generated vendored Normal file
View File

@@ -0,0 +1,137 @@
# response-time
[![NPM Version][npm-image]][npm-url]
[![NPM Downloads][downloads-image]][downloads-url]
[![Build Status][travis-image]][travis-url]
[![Test Coverage][coveralls-image]][coveralls-url]
[![Gratipay][gratipay-image]][gratipay-url]
Response time for Node.js servers.
This module creates a middleware that records the response time for
requests in HTTP servers. The "response time" is defined here as the
elapsed time from when a request enters this middleware to when the
headers are written out to the client.
## Installation
```sh
$ npm install response-time
```
## API
```js
var responseTime = require('response-time')
```
### responseTime([options])
Create a middleware that adds a `X-Response-Time` header to responses. If
you don't want to use this module to automatically set a header, please
see the section about [`responseTime(fn)`](#responsetimeoptions).
#### Options
The `responseTime` function accepts an optional `options` object that may
contain any of the following keys:
##### digits
The fixed number of digits to include in the output, which is always in
milliseconds, defaults to `3` (ex: `2.300ms`).
##### header
The name of the header to set, defaults to `X-Response-Time`.
##### suffix
Boolean to indicate if units of measurement suffix should be added to
the output, defaults to `true` (ex: `2.300ms` vs `2.300`).
### responseTime(fn)
Create a new middleware that records the response time of a request and
makes this available to your own function `fn`. The `fn` argument will be
invoked as `fn(req, res, time)`, where `time` is a number in milliseconds.
## Examples
### express/connect
```js
var express = require('express')
var responseTime = require('response-time')
var app = express()
app.use(responseTime())
app.get('/', function (req, res) {
res.send('hello, world!')
})
```
### vanilla http server
```js
var finalhandler = require('finalhandler')
var http = require('http')
var responseTime = require('response-time')
// create "middleware"
var _responseTime = responseTime()
http.createServer(function (req, res) {
var done = finalhandler(req, res)
_responseTime(req, res, function (err) {
if (err) return done(err)
// respond to request
res.setHeader('content-type', 'text/plain')
res.end('hello, world!')
})
})
```
### response time metrics
```js
var express = require('express')
var responseTime = require('response-time')
var StatsD = require('node-statsd')
var app = express()
var stats = new StatsD()
stats.socket.on('error', function (error) {
console.error(error.stack)
})
app.use(responseTime(function (req, res, time) {
var stat = (req.method + req.url).toLowerCase()
.replace(/[:\.]/g, '')
.replace(/\//g, '_')
stats.timing(stat, time)
}))
app.get('/', function (req, res) {
res.send('hello, world!')
})
```
## License
[MIT](LICENSE)
[npm-image]: https://img.shields.io/npm/v/response-time.svg
[npm-url]: https://npmjs.org/package/response-time
[travis-image]: https://img.shields.io/travis/expressjs/response-time/master.svg
[travis-url]: https://travis-ci.org/expressjs/response-time
[coveralls-image]: https://img.shields.io/coveralls/expressjs/response-time/master.svg
[coveralls-url]: https://coveralls.io/r/expressjs/response-time?branch=master
[downloads-image]: https://img.shields.io/npm/dm/response-time.svg
[downloads-url]: https://npmjs.org/package/response-time
[gratipay-image]: https://img.shields.io/gratipay/dougwilson.svg
[gratipay-url]: https://www.gratipay.com/dougwilson/

97
node_modules/response-time/index.js generated vendored Normal file
View File

@@ -0,0 +1,97 @@
/*!
* response-time
* Copyright(c) 2011 TJ Holowaychuk
* Copyright(c) 2014 Jonathan Ong
* Copyright(c) 2014-2015 Douglas Christopher Wilson
* MIT Licensed
*/
'use strict'
/**
* Module dependencies
* @api private
*/
var deprecate = require('depd')('response-time')
var onHeaders = require('on-headers')
/**
* Module exports
*/
module.exports = responseTime
/**
* Reponse time:
*
* Adds the `X-Response-Time` header displaying the response
* duration in milliseconds.
*
* @param {object} [options]
* @param {number} [options.digits=3]
* @return {function}
* @api public
*/
function responseTime (options) {
var opts = options || {}
if (typeof options === 'number') {
// back-compat single number argument
deprecate('number argument: use {digits: ' + JSON.stringify(options) + '} instead')
opts = { digits: options }
}
// get the function to invoke
var fn = typeof opts !== 'function'
? createSetHeader(opts)
: opts
return function responseTime (req, res, next) {
var startAt = process.hrtime()
onHeaders(res, function onHeaders () {
var diff = process.hrtime(startAt)
var time = diff[0] * 1e3 + diff[1] * 1e-6
fn(req, res, time)
})
next()
}
}
/**
* Create function to set respoonse time header.
* @api private
*/
function createSetHeader (options) {
// response time digits
var digits = options.digits !== undefined
? options.digits
: 3
// header name
var header = options.header || 'X-Response-Time'
// display suffix
var suffix = options.suffix !== undefined
? Boolean(options.suffix)
: true
return function setResponseHeader (req, res, time) {
if (res.getHeader(header)) {
return
}
var val = time.toFixed(digits)
if (suffix) {
val += 'ms'
}
res.setHeader(header, val)
}
}

84
node_modules/response-time/package.json generated vendored Normal file
View File

@@ -0,0 +1,84 @@
{
"_from": "response-time@^2.3.2",
"_id": "response-time@2.3.2",
"_inBundle": false,
"_integrity": "sha1-/6cbq5UtYvfB1Jt0NDVfvGjf/Fo=",
"_location": "/response-time",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "response-time@^2.3.2",
"name": "response-time",
"escapedName": "response-time",
"rawSpec": "^2.3.2",
"saveSpec": null,
"fetchSpec": "^2.3.2"
},
"_requiredBy": [
"/server"
],
"_resolved": "https://registry.npmjs.org/response-time/-/response-time-2.3.2.tgz",
"_shasum": "ffa71bab952d62f7c1d49b7434355fbc68dffc5a",
"_spec": "response-time@^2.3.2",
"_where": "/home/runner/Socketio-Chat-Template/node_modules/server",
"author": {
"name": "Jonathan Ong",
"email": "me@jongleberry.com",
"url": "http://jongleberry.com"
},
"bugs": {
"url": "https://github.com/expressjs/response-time/issues"
},
"bundleDependencies": false,
"contributors": [
{
"name": "Douglas Christopher Wilson",
"email": "doug@somethingdoug.com"
}
],
"dependencies": {
"depd": "~1.1.0",
"on-headers": "~1.0.1"
},
"deprecated": false,
"description": "Response time for Node.js servers",
"devDependencies": {
"after": "0.8.2",
"eslint": "3.10.1",
"eslint-config-standard": "6.2.1",
"eslint-plugin-promise": "3.3.2",
"eslint-plugin-standard": "2.0.1",
"istanbul": "0.4.5",
"mocha": "2.5.3",
"supertest": "1.1.0"
},
"engines": {
"node": ">= 0.8.0"
},
"files": [
"LICENSE",
"HISTORY.md",
"index.js"
],
"homepage": "https://github.com/expressjs/response-time#readme",
"keywords": [
"http",
"res",
"response time",
"x-response-time"
],
"license": "MIT",
"name": "response-time",
"repository": {
"type": "git",
"url": "git+https://github.com/expressjs/response-time.git"
},
"scripts": {
"lint": "eslint .",
"test": "mocha --reporter spec --bail --check-leaks test/",
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/",
"test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/"
},
"version": "2.3.2"
}