Update chai to ^1.10.0
Fix `loopback.getCurrentContext`

 - ensure the method is always defined

 - return `null` when the context is not active
   (we are not inside a request-handling chain)
middleware/token: store the token in current ctx
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
      }
    });
Merge pull request #775 from strongloop/feature/save-token-in-context

middleware/token: store the token in current ctx
Merge pull request #787 from strongloop/feature/app-middleware-v2

Implement app.middlewareFromConfig
Implement `app.defineMiddlewarePhases`

Implement method for registering (new) middleware phases.

 - If all names are new, then the phases are added just before
   the "routes" phase.

  - Otherwise the provided list of names is merged with the existing
   phases in such way that the order of phases is preserved.

Example

    // built-in phases:
    // initial, session, auth, parse, routes, files, final

    app.defineMiddlewarePhases('custom');
    // new list of phases
    //   initial, session, auth, parse,
    //   custom,
    //   routes, files, final

    app.defineMiddlewarePhases([
      'initial', 'postinit', 'preauth', 'routes', 'subapps'
    ]);
    // new list of phases
    //   initial,
    //   postinit, preauth,
    //   session, auth, parse, custom,
    //   routes,
    //   subapps,
    //   files, final