Express Server erstellt

This commit is contained in:
Lukas Nowy
2018-10-07 15:56:57 +02:00
parent eb7e787ea0
commit 216a04e233
412 changed files with 63855 additions and 37 deletions

16
express-server/node_modules/on-headers/HISTORY.md generated vendored Normal file
View File

@ -0,0 +1,16 @@
1.0.1 / 2015-09-29
==================
* perf: enable strict mode
1.0.0 / 2014-08-10
==================
* Honor `res.statusCode` change in `listener`
* Move to `jshttp` orgainzation
* Prevent `arguments`-related de-opt
0.0.0 / 2014-05-13
==================
* Initial implementation

22
express-server/node_modules/on-headers/LICENSE generated vendored Normal file
View File

@ -0,0 +1,22 @@
(The MIT License)
Copyright (c) 2014 Douglas Christopher Wilson
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.

76
express-server/node_modules/on-headers/README.md generated vendored Normal file
View File

@ -0,0 +1,76 @@
# on-headers
[![NPM Version][npm-image]][npm-url]
[![NPM Downloads][downloads-image]][downloads-url]
[![Node.js Version][node-version-image]][node-version-url]
[![Build Status][travis-image]][travis-url]
[![Test Coverage][coveralls-image]][coveralls-url]
Execute a listener when a response is about to write headers.
## Installation
```sh
$ npm install on-headers
```
## API
```js
var onHeaders = require('on-headers')
```
### onHeaders(res, listener)
This will add the listener `listener` to fire when headers are emitted for `res`.
The listener is passed the `response` object as it's context (`this`). Headers are
considered to be emitted only once, right before they are sent to the client.
When this is called multiple times on the same `res`, the `listener`s are fired
in the reverse order they were added.
## Examples
```js
var http = require('http')
var onHeaders = require('on-headers')
http
.createServer(onRequest)
.listen(3000)
function addPoweredBy() {
// set if not set by end of request
if (!this.getHeader('X-Powered-By')) {
this.setHeader('X-Powered-By', 'Node.js')
}
}
function onRequest(req, res) {
onHeaders(res, addPoweredBy)
res.setHeader('Content-Type', 'text/plain')
res.end('hello!')
}
```
## Testing
```sh
$ npm test
```
## License
[MIT](LICENSE)
[npm-image]: https://img.shields.io/npm/v/on-headers.svg
[npm-url]: https://npmjs.org/package/on-headers
[node-version-image]: https://img.shields.io/node/v/on-headers.svg
[node-version-url]: http://nodejs.org/download/
[travis-image]: https://img.shields.io/travis/jshttp/on-headers/master.svg
[travis-url]: https://travis-ci.org/jshttp/on-headers
[coveralls-image]: https://img.shields.io/coveralls/jshttp/on-headers/master.svg
[coveralls-url]: https://coveralls.io/r/jshttp/on-headers?branch=master
[downloads-image]: https://img.shields.io/npm/dm/on-headers.svg
[downloads-url]: https://npmjs.org/package/on-headers

93
express-server/node_modules/on-headers/index.js generated vendored Normal file
View File

@ -0,0 +1,93 @@
/*!
* on-headers
* Copyright(c) 2014 Douglas Christopher Wilson
* MIT Licensed
*/
'use strict'
/**
* Reference to Array slice.
*/
var slice = Array.prototype.slice
/**
* Execute a listener when a response is about to write headers.
*
* @param {Object} res
* @return {Function} listener
* @api public
*/
module.exports = function onHeaders(res, listener) {
if (!res) {
throw new TypeError('argument res is required')
}
if (typeof listener !== 'function') {
throw new TypeError('argument listener must be a function')
}
res.writeHead = createWriteHead(res.writeHead, listener)
}
function createWriteHead(prevWriteHead, listener) {
var fired = false;
// return function with core name and argument list
return function writeHead(statusCode) {
// set headers from arguments
var args = setWriteHeadHeaders.apply(this, arguments);
// fire listener
if (!fired) {
fired = true
listener.call(this)
// pass-along an updated status code
if (typeof args[0] === 'number' && this.statusCode !== args[0]) {
args[0] = this.statusCode
args.length = 1
}
}
prevWriteHead.apply(this, args);
}
}
function setWriteHeadHeaders(statusCode) {
var length = arguments.length
var headerIndex = length > 1 && typeof arguments[1] === 'string'
? 2
: 1
var headers = length >= headerIndex + 1
? arguments[headerIndex]
: undefined
this.statusCode = statusCode
// the following block is from node.js core
if (Array.isArray(headers)) {
// handle array case
for (var i = 0, len = headers.length; i < len; ++i) {
this.setHeader(headers[i][0], headers[i][1])
}
} else if (headers) {
// handle object case
var keys = Object.keys(headers)
for (var i = 0; i < keys.length; i++) {
var k = keys[i]
if (k) this.setHeader(k, headers[k])
}
}
// copy leading arguments
var args = new Array(Math.min(length, headerIndex))
for (var i = 0; i < args.length; i++) {
args[i] = arguments[i]
}
return args
}

69
express-server/node_modules/on-headers/package.json generated vendored Normal file
View File

@ -0,0 +1,69 @@
{
"_from": "on-headers@~1.0.1",
"_id": "on-headers@1.0.1",
"_inBundle": false,
"_integrity": "sha1-ko9dD0cNSTQmUepnlLCFfBAGk/c=",
"_location": "/on-headers",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "on-headers@~1.0.1",
"name": "on-headers",
"escapedName": "on-headers",
"rawSpec": "~1.0.1",
"saveSpec": null,
"fetchSpec": "~1.0.1"
},
"_requiredBy": [
"/morgan"
],
"_resolved": "https://registry.npmjs.org/on-headers/-/on-headers-1.0.1.tgz",
"_shasum": "928f5d0f470d49342651ea6794b0857c100693f7",
"_spec": "on-headers@~1.0.1",
"_where": "D:\\5CHITM\\Diplomarbeit\\smart-shopper\\express-server\\node_modules\\morgan",
"author": {
"name": "Douglas Christopher Wilson",
"email": "doug@somethingdoug.com"
},
"bugs": {
"url": "https://github.com/jshttp/on-headers/issues"
},
"bundleDependencies": false,
"dependencies": {},
"deprecated": false,
"description": "Execute a listener when a response is about to write headers",
"devDependencies": {
"istanbul": "0.3.21",
"mocha": "2.3.3",
"supertest": "1.1.0"
},
"engines": {
"node": ">= 0.8"
},
"files": [
"LICENSE",
"HISTORY.md",
"README.md",
"index.js"
],
"homepage": "https://github.com/jshttp/on-headers#readme",
"keywords": [
"event",
"headers",
"http",
"onheaders"
],
"license": "MIT",
"name": "on-headers",
"repository": {
"type": "git",
"url": "git+https://github.com/jshttp/on-headers.git"
},
"scripts": {
"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": "1.0.1"
}