# feathers-blueprints

> Add some of the Sails.js blueprints functionality to Feathers.

Latest version **0.0.13** (published 2015-01-02) · 0 weekly downloads

## Install

```sh
npm install feathers-blueprints
pnpm add feathers-blueprints
yarn add feathers-blueprints
bun add feathers-blueprints
```

## 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.13 |
| Published | 2015-01-02 |
| First published | 2014-05-31 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.10.0 |
| Dependencies | 4 |
| Known vulnerabilities | 0 (+5 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 5 |
| Author | Kevin Smith |
| Maintainers | ksmth |
| Keywords | feathers-plugin, feathers |

## Links

- npm: https://www.npmjs.com/package/feathers-blueprints
- Repository: https://github.com/ksmth/feathers-blueprints
- Issues: https://github.com/ksmth/feathers-blueprints/issues
- npm.io page: https://npm.io/package/feathers-blueprints

## Dependencies (4)

- [async](https://npm.io/package/async.md) ^0.9.0
- [lodash](https://npm.io/package/lodash.md) ^2.4.1
- [waterline](https://npm.io/package/waterline.md) ^0.10.11
- [sails-disk](https://npm.io/package/sails-disk.md) ^0.10.1

## Alternatives

- [@fortawesome/react-fontawesome](https://npm.io/package/@fortawesome/react-fontawesome.md) — 2.2M weekly downloads
- [roboto-fontface](https://npm.io/package/roboto-fontface.md) — 196.0K weekly downloads
- [@react-native-vector-icons/common](https://npm.io/package/@react-native-vector-icons/common.md) — 150.4K weekly downloads
- [@procore/core-icons](https://npm.io/package/@procore/core-icons.md) — 4.6K weekly downloads
- [@react-md/material-icons](https://npm.io/package/@react-md/material-icons.md) — 1.6K weekly downloads

## Recent versions

- 0.0.13 (latest) — 2015-01-02
- 0.0.12 — 2014-12-28
- 0.0.11 — 2014-10-15
- 0.0.10 — 2014-10-15
- 0.0.9 — 2014-10-15
- 0.0.8 — 2014-10-15
- 0.0.7 — 2014-08-09
- 0.0.6 — 2014-08-09
- 0.0.5 — 2014-06-01
- 0.0.4 — 2014-05-31
- 0.0.3 — 2014-05-31
- 0.0.2 — 2014-05-31
- 0.0.1 — 2014-05-31

## README

# feathers-blueprints

> Add some of the Sails.js blueprints functionality to Feathers.

## Getting Started

To install feathers-blueprints from [npm](https://www.npmjs.org/), run:

```bash
$ npm install feathers-blueprints --save
```

Finally, to use the plugin in your Feathers app:

```javascript
var feathers   = require('feathers');
var blueprints = require('feathers-blueprints');
var app        = feathers();
// Use Blueprints
app.configure(blueprints.api(function () {
    app.listen(8080)
}));
```

__IMPORTANT:__ Make sure to call `app.listen` _after_ the callback of `blueprints.api(config, callback)` has been called. Otherwise the Services won't be setup properly and the socket connections will not work.

## Documentation

By default, the blueprints assume a folder structure like this:

```
.
├── models/
│   ├── messages.js
│   └── users.js
├── node_modules/
├── services/
│   └── users.js
└── app.js
```

For each model definition inside `/models` a blueprint will be created if a corresponding service does not exist in `/services`.

### Configuration

You can override the paths for the model and service lookup and also provide your own `Waterline` configuration.

```JavaScript
var diskAdapter  = require('sails-disk');
var mysqlAdapter = require('sails-mysql');

app.configure(blueprints.api({

    modelsPath   : '/path/to/models/directory',
    servicesPath : '/path/to/services/directory',
    waterline    : {

        adapters: {
            'default' : diskAdapter,
            disk      : diskAdapter,
            mysql     : mysqlAdapter
        },

        connections: {
            disk : {
                adapter : 'disk'
            },

            mysql : {
                adapter  : 'mysql',
                host     : 'localhost',
                database : 'foobar'
            }
        },

        defaults : {
            migrate : 'alter'
        }
    };

}, function () {
    app.listen(8080);
}));
```

### Override blueprints

To override or modify a blueprint, create a file with the same name inside the `/services` folder. The backing `Waterline.Collection` is accessible through `this.collection` inside a service. You can use the blueprints as a starting point:

```JavaScript
// 'services/users.js'
var blueprints = require('feathers-blueprints');

var UsersService = blueprints.create('Users');

UsersService.prototype.create = function (data, params, callback) {
    // do custom stuff
};

module.exports = UsersService;
```

## Author

- [Kevin Smith](https://github.com/ksmth)

## License

Copyright (c) 2014 Kevin Smith

Licensed under the [MIT license](LICENSE).

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