Skip to content
Browse files

Update README.

  • Loading branch information...
1 parent 66b535e commit 1e51f38eda45f9425656ca1449c9a80ade263b58 @gasi gasi committed Apr 17, 2011
Showing with 32 additions and 33 deletions.
  1. +32 −33 readme.md
View
65 readme.md
@@ -1,36 +1,35 @@
-
+# HTTP Status
Utility to interact with HTTP status code.
-Usage
------
-
-API sample
-
- var HttpStatus = require('http-status');
-
- // Print "Internal Server Error"
- console.log( HttpStatus['500'] );
-
- // Print "500"
- console.log( HttpStatus.InternalServerError );
-
-Express sample
-
- var express = require('express'),
- redis = require('redis'),
- HttpStatus = require('http-status');
-
- var app = express.createServer();
-
- app.get('/', function(req, res){
- var client = redis.createClient();
- client.ping(function(err, msg){
- if(err){
- return res.send( HttpStatus.InternalServerError );
- }
- res.send( msg, HttpStatus.OK );
- });
- });
-
- app.listen(3000);
+## Usage
+
+### API sample
+
+ var HTTPStatus = require('http-status');
+
+ // Print "Internal Server Error"
+ console.log(HTTPStatus[500]);
+
+ // Print 500
+ console.log(HTTPStatus.INTERNAL_SERVER_ERROR);
+
+### Express sample
+
+ var express = require('express'),
+ redis = require('redis'),
+ HTTPStatus = require('http-status');
+
+ var app = express.createServer();
+
+ app.get('/', function (req, res) {
+ var client = redis.createClient();
+ client.ping(function (err, msg) {
+ if (err) {
+ return res.send(HTTPStatus.INTERNAL_SERVER_ERROR);
+ }
+ res.send(msg, HTTPStatus.OK);
+ });
+ });
+
+ app.listen(3000);

0 comments on commit 1e51f38

Please sign in to comment.
Something went wrong with that request. Please try again.