Browse files

In keeping with the design philosphy, changed method for retrieving a…

… ResponseBuilder from bogart.response() to bogart.res()
  • Loading branch information...
1 parent 1e492d1 commit 256b53a579e4bf4584bc4178c21cda76fbc5c9a8 @nrstott committed Jan 15, 2012
Showing with 13 additions and 4 deletions.
  1. +3 −1 README.md
  2. +10 −3 lib/bogart.js
View
4 README.md
@@ -253,7 +253,9 @@ when working with callback based functions that cannot be wrapped by `bogart.pro
var router = bogart.router();
router.get('/', function(req) {
- var res = bogart.response();
+
+ // Get a ResponseBuilder
+ var res = bogart.res();
doSomethingAsync(function(err, messageStr) {
res.setHeader('Content-Type', 'text/plain');
View
13 lib/bogart.js
@@ -695,7 +695,7 @@ var ResponseBuilder = exports.ResponseBuilder = function(viewEngine) {
*
* var viewEngine = bogart.viewEngine('mustache');
* app.get('/', function(req) {
- * var resp = bogart.response(viewEngine);
+ * var resp = bogart.res(viewEngine);
*
* doSomethingAsync(function(err, str) {
* if (err) {
@@ -713,12 +713,19 @@ var ResponseBuilder = exports.ResponseBuilder = function(viewEngine) {
* @param {ViewEngine} viewEngine The ViewEngine to be used by response helpers for rendering views.
* @returns {ResponseBuilder} An object with methods to help build a response.
*/
-exports.response = function(viewEngine) {
+exports.res = function(viewEngine) {
return new ResponseBuilder(viewEngine);
};
+exports.response = function(viewEngine) {
+ console.log('bogart.response() called, bogart.res() is now the preferred, wrist-friendly, ' +
+ 'version of this method. bogart.response() will be removed in the future.');
+
+ return bogart.res(viewEngine);
+};
+
function pipeStream(stream, opts) {
- var response = exports.response();
+ var response = exports.res();
opts = opts || {};

0 comments on commit 256b53a

Please sign in to comment.