https://github.com/offirmo/network-constants.js
Just a bunch of network (mainly HTTP) constants for js programs (node + browser), AMD
https://github.com/offirmo/network-constants.js
Last synced: over 1 year ago
JSON representation
Just a bunch of network (mainly HTTP) constants for js programs (node + browser), AMD
- Host: GitHub
- URL: https://github.com/offirmo/network-constants.js
- Owner: Offirmo
- License: unlicense
- Created: 2013-10-16T14:13:06.000Z (almost 13 years ago)
- Default Branch: master
- Last Pushed: 2014-09-12T16:28:49.000Z (almost 12 years ago)
- Last Synced: 2025-03-23T06:11:20.779Z (over 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 285 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
network-constants.js
====================
[](https://travis-ci.org/Offirmo/network-constants.js)
[](http://badge.fury.io/js/network-constants)
[](http://badge.fury.io/bo/network-constants.js)
[](https://gemnasium.com/Offirmo/network-constants.js)
[](http://offirmo.net/classifying-open-source-projects-status/)
[](http://unlicense.org/)
[](https://codeclimate.com/github/Offirmo/network-constants.js)
[](https://sourcegraph.com/github.com/Offirmo/network-constants.js)
[](https://sourcegraph.com/github.com/Offirmo/network-constants.js)
[](https://www.gittip.com/Offirmo/)
Introduction
------------
A clean declaration of network constants (only HTTP for now) for js programs.
Useful when developing network programs or if you want to use HTTP semantics (REST API).
Works in node.js + browser, AMD.
Full testsuite. No dependencies.
License : public domain (http://unlicense.org/)
Fell free to suggest and contribute.
Interesting reads :
http://en.wikipedia.org/wiki/List_of_HTTP_status_codes
http://www.codeshttp.com/ (us / french)
http://benramsey.com/blog/2009/02/http-status-100-continue-corrections/
http://benramsey.com/blog/2008/04/http-status-201-created-vs-202-accepted/
http://benramsey.com/blog/2008/05/http-status-204-no-content-and-205-reset-content/
http://benramsey.com/blog/2008/05/206-partial-content-and-range-requests/
http://benramsey.com/blog/2009/11/post-vs-put/
Usage
-----
```javascript
if (typeof define !== 'function') { var define = require('amdefine')(module); } // node only
define(
[
'network-constants/http'
],
function(http_constants) {
"use strict";
console.log( http_constants.methods.get ); // "GET"
console.log( http_constants.status_codes.status_400_client_error_bad_request ); // 400
console.log( http_constants.status_messages[404] ); // "Not Found"
...
```
Installation
------------
Bower : `bower install network-constants.js`
Npm : `npm install network-constants`
Unit tests
----------
Browser : open test_runner/mocha.html
Node : `npm test`