1 | # loopback-remote-routing
|
2 |
|
3 | Easily disable remote methods.
|
4 |
|
5 | ##Installation
|
6 |
|
7 | ```bash
|
8 | npm install loopback-remote-routing --save
|
9 | ```
|
10 |
|
11 | ##How to use
|
12 |
|
13 | ```js
|
14 |
|
15 | // common/models/color.js
|
16 | var RemoteRouting = require('loopback-remote-routing');
|
17 |
|
18 | module.exports = function(Color) {
|
19 | // use only to expose specified remote methods
|
20 | // symbol @ denotes static method
|
21 | RemoteRouting(Color, {only: [
|
22 | '@find',
|
23 | '@findById',
|
24 | 'updateAttributes'
|
25 | ]})
|
26 |
|
27 | //use except to expose all remote methods except specified ones
|
28 | RemoteRouting(Color, {except: [
|
29 | '@create',
|
30 | '@find'
|
31 | ]}
|
32 |
|
33 | //disable all remote methods omitting options
|
34 |
|
35 | RemoteRouting(Color)
|
36 | }
|
37 | ```
|
38 | you can only use options.only or options.except, do not use them together.
|