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 3.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. # serve-favicon
  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. [![Gittip][gittip-image]][gittip-url]
  7. Node.js middleware for serving a favicon.
  8. Why use this module?
  9. - User agents request `favicon.ico` frequently and indiscriminately, so you
  10. may wish to exclude these requests from your logs by using this middleware
  11. before your logger middleware.
  12. - This module caches the icon in memory to improve performance by skipping
  13. disk access.
  14. - This module provides an `ETag` based on the contents of the icon, rather
  15. than file system properties.
  16. - This module will serve with the most compatible `Content-Type`.
  17. ## Install
  18. ```bash
  19. npm install serve-favicon
  20. ```
  21. ## API
  22. ### favicon(path, options)
  23. Create new middleware to serve a favicon from the given `path` to a favicon file.
  24. `path` may also be a `Buffer` of the icon to serve.
  25. #### Options
  26. Serve favicon accepts these properties in the options object.
  27. ##### maxAge
  28. The `cache-control` `max-age` directive in `ms`, defaulting to 1 day. This can
  29. also be a string accepted by the [ms](https://www.npmjs.org/package/ms#readme)
  30. module.
  31. ## Examples
  32. Typically this middleware will come very early in your stack (maybe even first)
  33. to avoid processing any other middleware if we already know the request is for
  34. `/favicon.ico`.
  35. ### express
  36. ```javascript
  37. var express = require('express');
  38. var favicon = require('serve-favicon');
  39. var app = express();
  40. app.use(favicon(__dirname + '/public/favicon.ico'));
  41. // Add your routes here, etc.
  42. app.listen(3000);
  43. ```
  44. ### connect
  45. ```javascript
  46. var connect = require('connect');
  47. var favicon = require('serve-favicon');
  48. var app = connect();
  49. app.use(favicon(__dirname + '/public/favicon.ico'));
  50. // Add your middleware here, etc.
  51. app.listen(3000);
  52. ```
  53. ### vanilla http server
  54. This middleware can be used anywhere, even outside express/connect. It takes
  55. `req`, `res`, and `callback`.
  56. ```javascript
  57. var http = require('http');
  58. var favicon = require('serve-favicon');
  59. var finalhandler = require('finalhandler');
  60. var _favicon = favicon(__dirname + '/public/favicon.ico');
  61. var server = http.createServer(function onRequest(req, res) {
  62. var done = finalhandler(req, res);
  63. _favicon(req, res, function onNext(err) {
  64. if (err) return done(err);
  65. // continue to process the request here, etc.
  66. res.statusCode = 404;
  67. res.end('oops');
  68. });
  69. });
  70. server.listen(3000);
  71. ```
  72. ## License
  73. [MIT](LICENSE)
  74. [npm-image]: https://img.shields.io/npm/v/serve-favicon.svg?style=flat
  75. [npm-url]: https://npmjs.org/package/serve-favicon
  76. [travis-image]: https://img.shields.io/travis/expressjs/serve-favicon.svg?style=flat
  77. [travis-url]: https://travis-ci.org/expressjs/serve-favicon
  78. [coveralls-image]: https://img.shields.io/coveralls/expressjs/serve-favicon.svg?style=flat
  79. [coveralls-url]: https://coveralls.io/r/expressjs/serve-favicon?branch=master
  80. [downloads-image]: https://img.shields.io/npm/dm/serve-favicon.svg?style=flat
  81. [downloads-url]: https://npmjs.org/package/serve-favicon
  82. [gittip-image]: https://img.shields.io/gittip/dougwilson.svg?style=flat
  83. [gittip-url]: https://www.gittip.com/dougwilson/