expressjs-plus
Advanced tools
Comparing version 0.1.3 to 0.1.4
@@ -30,2 +30,3 @@ 'use strict'; | ||
var app = express(); | ||
// simple handler example | ||
var userHandler = function(param, paramsArray, req, res){ | ||
@@ -36,2 +37,5 @@ if(param !== 'user') return false; | ||
}; | ||
// this handler allows you to pass res.locals properties between your middlewares seemingly, | ||
// it the parameter was found in locals, it attaches it to paramsArray. | ||
var resLocalsHandler = function(param, paramsArray, req, res){ | ||
@@ -48,8 +52,14 @@ if(param in res.locals){ | ||
// resLocalsVar was passed in a previous method | ||
var regularFunction2 = function(resLocalsVar, user, id, cb){ | ||
// now you can have access to it | ||
console.log(resLocalsVar); | ||
return cb(null); | ||
}; | ||
// the responder at the end will use res.locals.status and res.locals.response to issue an HTTP response | ||
app.use(appPlus.GMV(regularFunction), appPlus.GMV(regularFunction2), appPlus.responder); | ||
// adds error handlers, it will add a default error handler along with the list of error handlers passed | ||
// in this case, no error handlers were passed | ||
appPlus.setErrorHandlers(); | ||
@@ -56,0 +66,0 @@ |
{ | ||
"name": "expressjs-plus", | ||
"version": "0.1.3", | ||
"version": "0.1.4", | ||
"description": "A pluggable expansion to express js aimed at adding much needed features and helpers.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -38,2 +38,3 @@ <a name="ExpressPlus"></a> | ||
var app = express(); | ||
// simple handler example | ||
var userHandler = function(param, paramsArray, req, res){ | ||
@@ -44,2 +45,5 @@ if(param !== 'user') return false; | ||
}; | ||
// this handler allows you to pass res.locals properties between your middlewares seemingly, | ||
// it the parameter was found in locals, it attaches it to paramsArray. | ||
var resLocalsHandler = function(param, paramsArray, req, res){ | ||
@@ -56,8 +60,14 @@ if(param in res.locals){ | ||
// resLocalsVar was passed in a previous method | ||
var regularFunction2 = function(resLocalsVar, user, id, cb){ | ||
// now you can have access to it | ||
console.log(resLocalsVar); | ||
return cb(null); | ||
}; | ||
// the responder at the end will use res.locals.status and res.locals.response to issue an HTTP response | ||
app.use(appPlus.GMV(regularFunction), appPlus.GMV(regularFunction2), appPlus.responder); | ||
// adds error handlers, it will add a default error handler along with the list of error handlers passed | ||
// in this case, no error handlers were passed | ||
appPlus.setErrorHandlers(); | ||
@@ -64,0 +74,0 @@ |
@@ -17,2 +17,3 @@ /** | ||
var app = express(); | ||
// simple handler example | ||
var userHandler = function(param, paramsArray, req, res){ | ||
@@ -23,2 +24,5 @@ if(param !== 'user') return false; | ||
}; | ||
// this handler allows you to pass res.locals properties between your middlewares seemingly, | ||
// it the parameter was found in locals, it attaches it to paramsArray. | ||
var resLocalsHandler = function(param, paramsArray, req, res){ | ||
@@ -35,8 +39,14 @@ if(param in res.locals){ | ||
// resLocalsVar was passed in a previous method | ||
var regularFunction2 = function(resLocalsVar, user, id, cb){ | ||
// now you can have access to it | ||
console.log(resLocalsVar); | ||
return cb(null); | ||
}; | ||
// the responder at the end will use res.locals.status and res.locals.response to issue an HTTP response | ||
app.use(appPlus.GMV(regularFunction), appPlus.GMV(regularFunction2), appPlus.responder); | ||
// adds error handlers, it will add a default error handler along with the list of error handlers passed | ||
// in this case, no error handlers were passed | ||
appPlus.setErrorHandlers(); | ||
@@ -43,0 +53,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
34941
604
206