Skip to content

Commit

Permalink
readme: fix api example #36
Browse files Browse the repository at this point in the history
  • Loading branch information
wdavidw committed Nov 12, 2019
1 parent 2d3d122 commit 9310bce
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog: HTTP Status

## Trunk

* readme: fix api example

## Version 1.4.0

* codes: add status code classes
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ console.info(status[500]);
console.info(status[status.INTERNAL_SERVER_ERROR]);
// Both output: "Internal Server Error"

console.info(status['500_CODE']);
console.info(status[`${status.INTERNAL_SERVER_ERROR}_CODE`]);
console.info(status['500_NAME']);
console.info(status[`${status.INTERNAL_SERVER_ERROR}_NAME`]);
// Both output: "INTERNAL_SERVER_ERROR"

console.info(status['500_MESSAGE']);
Expand Down
8 changes: 4 additions & 4 deletions samples/api.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const status = require('http-status');
const status = require('..');

console.info(status.INTERNAL_SERVER_ERROR);
// Output: 500
Expand All @@ -7,8 +7,8 @@ console.info(status[500]);
console.info(status[status.INTERNAL_SERVER_ERROR]);
// Both output: "Internal Server Error"

console.info(status['500_CODE']);
console.info(status[`${status.INTERNAL_SERVER_ERROR}_CODE`]);
console.info(status['500_NAME']);
console.info(status[`${status.INTERNAL_SERVER_ERROR}_NAME`]);
// Both output: "INTERNAL_SERVER_ERROR"

console.info(status['500_MESSAGE']);
Expand All @@ -17,4 +17,4 @@ console.info(status[`${status.INTERNAL_SERVER_ERROR}_MESSAGE`]);

console.info(status['500_CLASS']);
console.info(status[`${status.INTERNAL_SERVER_ERROR}_CLASS`]);
// Both output: "5xx"
// Both output: "5xx"
2 changes: 1 addition & 1 deletion samples/express.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const express = require('express'),
redis = require('redis'),
status = require('http-status');
status = require('..');
// New Express HTTP server
const app = express.createServer();
// Regster a route
Expand Down

0 comments on commit 9310bce

Please sign in to comment.