Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
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.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. # Statuses
  2. [![NPM Version][npm-image]][npm-url]
  3. [![NPM Downloads][downloads-image]][downloads-url]
  4. [![Node.js Version][node-version-image]][node-version-url]
  5. [![Build Status][travis-image]][travis-url]
  6. [![Test Coverage][coveralls-image]][coveralls-url]
  7. HTTP status utility for node.
  8. This module provides a list of status codes and messages sourced from
  9. a few different projects:
  10. * The [IANA Status Code Registry](https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml)
  11. * The [Node.js project](https://nodejs.org/)
  12. * The [NGINX project](https://www.nginx.com/)
  13. * The [Apache HTTP Server project](https://httpd.apache.org/)
  14. ## Installation
  15. This is a [Node.js](https://nodejs.org/en/) module available through the
  16. [npm registry](https://www.npmjs.com/). Installation is done using the
  17. [`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):
  18. ```sh
  19. $ npm install statuses
  20. ```
  21. ## API
  22. <!-- eslint-disable no-unused-vars -->
  23. ```js
  24. var status = require('statuses')
  25. ```
  26. ### var code = status(Integer || String)
  27. If `Integer` or `String` is a valid HTTP code or status message, then the
  28. appropriate `code` will be returned. Otherwise, an error will be thrown.
  29. <!-- eslint-disable no-undef -->
  30. ```js
  31. status(403) // => 403
  32. status('403') // => 403
  33. status('forbidden') // => 403
  34. status('Forbidden') // => 403
  35. status(306) // throws, as it's not supported by node.js
  36. ```
  37. ### status.STATUS_CODES
  38. Returns an object which maps status codes to status messages, in
  39. the same format as the
  40. [Node.js http module](https://nodejs.org/dist/latest/docs/api/http.html#http_http_status_codes).
  41. ### status.codes
  42. Returns an array of all the status codes as `Integer`s.
  43. ### var msg = status[code]
  44. Map of `code` to `status message`. `undefined` for invalid `code`s.
  45. <!-- eslint-disable no-undef, no-unused-expressions -->
  46. ```js
  47. status[404] // => 'Not Found'
  48. ```
  49. ### var code = status[msg]
  50. Map of `status message` to `code`. `msg` can either be title-cased or
  51. lower-cased. `undefined` for invalid `status message`s.
  52. <!-- eslint-disable no-undef, no-unused-expressions -->
  53. ```js
  54. status['not found'] // => 404
  55. status['Not Found'] // => 404
  56. ```
  57. ### status.redirect[code]
  58. Returns `true` if a status code is a valid redirect status.
  59. <!-- eslint-disable no-undef, no-unused-expressions -->
  60. ```js
  61. status.redirect[200] // => undefined
  62. status.redirect[301] // => true
  63. ```
  64. ### status.empty[code]
  65. Returns `true` if a status code expects an empty body.
  66. <!-- eslint-disable no-undef, no-unused-expressions -->
  67. ```js
  68. status.empty[200] // => undefined
  69. status.empty[204] // => true
  70. status.empty[304] // => true
  71. ```
  72. ### status.retry[code]
  73. Returns `true` if you should retry the rest.
  74. <!-- eslint-disable no-undef, no-unused-expressions -->
  75. ```js
  76. status.retry[501] // => undefined
  77. status.retry[503] // => true
  78. ```
  79. [npm-image]: https://img.shields.io/npm/v/statuses.svg
  80. [npm-url]: https://npmjs.org/package/statuses
  81. [node-version-image]: https://img.shields.io/node/v/statuses.svg
  82. [node-version-url]: https://nodejs.org/en/download
  83. [travis-image]: https://img.shields.io/travis/jshttp/statuses.svg
  84. [travis-url]: https://travis-ci.org/jshttp/statuses
  85. [coveralls-image]: https://img.shields.io/coveralls/jshttp/statuses.svg
  86. [coveralls-url]: https://coveralls.io/r/jshttp/statuses?branch=master
  87. [downloads-image]: https://img.shields.io/npm/dm/statuses.svg
  88. [downloads-url]: https://npmjs.org/package/statuses