Merge pull request #2721 from strongloop/docs/context-upgrade-2x-3x

Add instructions for upgrading context
This commit is contained in:
Miroslav Bajtoš 2016-09-07 13:03:39 +02:00 committed by GitHub
commit 554ccbd035
1 changed files with 30 additions and 1 deletions

View File

@ -162,9 +162,38 @@ We have removed the following current-context-related APIs:
- `loopback.createContext`
- `loopback.runInContext`
Additionaly, `loopback#context` middleware and `remoting.context` server
Additionally, `loopback#context` middleware and `remoting.context` server
config were removed too.
#### Upgrading from 2.x to 3.x
When upgrading from LoopBack 2.x, you need to disable or remove
`remoting.context` configuration in your server config.
```js
{
"remoting": {
"context": false, // or remove completely
// etc.
},
// etc.
}
```
Without this change, you will see the following error on the first HTTP request
received:
```
Unhandled error for request GET /api/Users:
Error: remoting.context option was removed in version 3.0.
See https://docs.strongloop.com/display/APIC/Using%20current%20context for more
details.
at restApiHandler (.../node_modules/loopback/server/middleware/rest.js:44:15)
at Layer.handle [as handle_request] (.../node_modules/express/lib/router/layer.js:95:5)
```
#### Setting up "current context" in 3.x
To setup "current context" feature in your LoopBack 3.x application, you
should use [loopback-context](https://www.npmjs.com/package/loopback-context)
module: