Merge pull request #138 from strongloop/feature/fix-middleware-events-examples
Replace `on` with `once` in middleware examples
This commit is contained in:
commit
d745d1a924
|
@ -451,7 +451,7 @@ function tryReadConfig(cwd, fileName) {
|
|||
*
|
||||
* Usage:
|
||||
* ```js
|
||||
* app.on('middleware:preprocessors', function() {
|
||||
* app.once('middleware:preprocessors', function() {
|
||||
* app.use(loopback.limit('5.5mb'))
|
||||
* });
|
||||
* ```
|
||||
|
@ -461,7 +461,7 @@ function tryReadConfig(cwd, fileName) {
|
|||
*
|
||||
* Usage:
|
||||
* ```js
|
||||
* app.on('middleware:handlers', function() {
|
||||
* app.once('middleware:handlers', function() {
|
||||
* app.use('/admin', adminExpressApp);
|
||||
* app.use('/custom', function(req, res, next) {
|
||||
* res.send(200, { url: req.url });
|
||||
|
@ -483,7 +483,7 @@ function tryReadConfig(cwd, fileName) {
|
|||
* ```js
|
||||
* var bunyan = require('bunyan');
|
||||
* var log = bunyan.createLogger({name: "myapp"});
|
||||
* app.on('middleware:error-loggers', function() {
|
||||
* app.once('middleware:error-loggers', function() {
|
||||
* app.use(function(err, req, res, next) {
|
||||
* log.error(err);
|
||||
* next(err);
|
||||
|
|
Loading…
Reference in New Issue