Merge pull request #2721 from strongloop/docs/context-upgrade-2x-3x
Add instructions for upgrading context
This commit is contained in:
commit
554ccbd035
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue