# loopback-disable-method-mixin

> A mixin to disable or expose a list of properties in a model

Latest version **0.0.1** (published 2018-04-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install loopback-disable-method-mixin
pnpm add loopback-disable-method-mixin
yarn add loopback-disable-method-mixin
bun add loopback-disable-method-mixin
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.1 |
| Published | 2018-04-30 |
| First published | 2018-04-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 6.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | b3rew |
| Maintainers | b3rew |
| Keywords | loopback, strongloop, mixin, disable, properties, methods |

## Links

- npm: https://www.npmjs.com/package/loopback-disable-method-mixin
- Repository: https://github.com/b3rew/loopback-disable-method-mixin
- Homepage: https://github.com/b3rew/loopback-disable-method-mixin#readme
- Issues: https://github.com/b3rew/loopback-disable-method-mixin/issues
- npm.io page: https://npm.io/package/loopback-disable-method-mixin

## Recent versions

- 0.0.1 (latest) — 2018-04-30

## README

# loopback-disable-method-mixin

A mixin to disable or expose a list of properties in a model.

#### based on

* https://github.com/strongloop/loopback/issues/651
* https://gist.github.com/drmikecrowe/7ec75265fda2788e1c08249ece505a44

## INSTALL

```
npm install --save loopback-disable-method-mixin
```

###### you can enable mixin by editing `server.js`:

In your server/server.js file add the following line before the boot(app, \_\_dirname); line.

```js
...
var app = module.exports = loopback();
...
// Add Disable Method Mixin to loopback
require('loopback-disable-method-mixin')(app);

boot(app, __dirname, function(err) {
  'use strict';
  if (err) throw err;

  // start the server if `$ node server.js`
  if (require.main === module)
    app.start();
});
```

## CONFIG

To use with your Models add the `mixins` attribute to the definition object of your model config.

```json
{
  "name": "player",
  "mixins": {
    "DisableMethods": {
      "expose": ["find", "findById"]
    }
  },
  "properties": {
    "name": "string",
    "type": "string"
  }
}
```

#### OR

```json
{
  "name": "player",
  "mixins": {
    "DisableMethods": {
      "hide": ["find"]
    }
  },
  "properties": {
    "name": "string",
    "type": "string"
  }
}
```

## LICENSE

MIT

---
_Source: https://npm.io/package/loopback-disable-method-mixin · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
