strongloop/loopback — pull request #787 by bajtos (2014-11-11 17:01:53+00:00)
Title: Implement app.middlewareFromConfig

Implement a function registering a middleware using a factory function
and a JSON config.

Example:

app.middlewareFromConfig(compression, {
enabled: true,
phase: 'initial',
config: {
threshold: 128
}
});

The API is more or less consistent with `app.model(ModelCtor, config)` and `loopback.configureModel(ModelCtor, config)`.

See also my [comment](https://github.com/strongloop/loopback-boot/issues/44#issuecomment-62569432) in https://github.com/strongloop/loopback-boot/issues/44

/to @ritch @raymondfeng please review