Ein Projekt das es ermöglicht Beerpong über das Internet von zwei unabhängigen positionen aus zu spielen. Entstehung im Rahmen einer Praktikumsaufgabe im Fach Interaktion.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 2.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. # cookie-parser
  2. [![NPM Version][npm-image]][npm-url]
  3. [![NPM Downloads][downloads-image]][downloads-url]
  4. [![Build Status][travis-image]][travis-url]
  5. [![Test Coverage][coveralls-image]][coveralls-url]
  6. Parse `Cookie` header and populate `req.cookies` with an object keyed by the cookie
  7. names. Optionally you may enable signed cookie support by passing a `secret` string,
  8. which assigns `req.secret` so it may be used by other middleware.
  9. ## Installation
  10. ```sh
  11. $ npm install cookie-parser
  12. ```
  13. ## API
  14. ```js
  15. var express = require('express')
  16. var cookieParser = require('cookie-parser')
  17. var app = express()
  18. app.use(cookieParser())
  19. ```
  20. ### cookieParser(secret, options)
  21. - `secret` a string used for signing cookies. This is optional and if not specified, will not parse signed cookies.
  22. - `options` an object that is passed to `cookie.parse` as the second option. See [cookie](https://www.npmjs.org/package/cookie) for more information.
  23. - `decode` a function to decode the value of the cookie
  24. ### cookieParser.JSONCookie(str)
  25. Parse a cookie value as a JSON cookie. This will return the parsed JSON value if it was a JSON cookie, otherwise it will return the passed value.
  26. ### cookieParser.JSONCookies(cookies)
  27. Given an object, this will iterate over the keys and call `JSONCookie` on each value. This will return the same object passed in.
  28. ### cookieParser.signedCookie(str, secret)
  29. Parse a cookie value as a signed cookie. This will return the parsed unsigned value if it was a signed cookie and the signature was valid, otherwise it will return the passed value.
  30. ### cookieParser.signedCookies(cookies, secret)
  31. Given an object, this will iterate over the keys and check if any value is a signed cookie. If it is a signed cookie and the signature is valid, the key will be deleted from the object and added to the new object that is returned.
  32. ## Example
  33. ```js
  34. var express = require('express')
  35. var cookieParser = require('cookie-parser')
  36. var app = express()
  37. app.use(cookieParser())
  38. app.get('/', function(req, res) {
  39. console.log("Cookies: ", req.cookies)
  40. })
  41. app.listen(8080)
  42. // curl command that sends an HTTP request with two cookies
  43. // curl http://127.0.0.1:8080 --cookie "Cho=Kim;Greet=Hello"
  44. ```
  45. ### [MIT Licensed](LICENSE)
  46. [npm-image]: https://img.shields.io/npm/v/cookie-parser.svg?style=flat
  47. [npm-url]: https://npmjs.org/package/cookie-parser
  48. [travis-image]: https://img.shields.io/travis/expressjs/cookie-parser.svg?style=flat
  49. [travis-url]: https://travis-ci.org/expressjs/cookie-parser
  50. [coveralls-image]: https://img.shields.io/coveralls/expressjs/cookie-parser.svg?style=flat
  51. [coveralls-url]: https://coveralls.io/r/expressjs/cookie-parser?branch=master
  52. [downloads-image]: https://img.shields.io/npm/dm/cookie-parser.svg?style=flat
  53. [downloads-url]: https://npmjs.org/package/cookie-parser