# @hoodie/server

> Hapi plugin for Hoodie’s server core module

Latest version **23.0.0** (published 2017-03-08) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @hoodie/server
pnpm add @hoodie/server
yarn add @hoodie/server
bun add @hoodie/server
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 23.0.0 |
| Published | 2017-03-08 |
| First published | 2016-04-22 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=4 |
| Dependencies | 14 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 241 |
| Maintainers | hoodie |
| Keywords | hapi, plugin |

## Links

- npm: https://www.npmjs.com/package/@hoodie/server
- Repository: https://github.com/hoodiehq/hoodie-server
- Homepage: https://github.com/hoodiehq/hoodie-server#readme
- Issues: https://github.com/hoodiehq/hoodie-server/issues
- npm.io page: https://npm.io/package/@hoodie/server

## Dependencies (14)

- [boom](https://npm.io/package/boom.md) ^4.2.0
- [h2o2](https://npm.io/package/h2o2.md) ^5.1.0
- [async](https://npm.io/package/async.md) ^2.1.5
- [inert](https://npm.io/package/inert.md) ^4.0.1
- [lodash](https://npm.io/package/lodash.md) ^4.14.1
- [vision](https://npm.io/package/vision.md) ^4.1.0
- [request](https://npm.io/package/request.md) ^2.80.0
- [jsonfile](https://npm.io/package/jsonfile.md) ^2.3.1
- [randomstring](https://npm.io/package/randomstring.md) ^1.1.5
- [pouchdb-admins](https://npm.io/package/pouchdb-admins.md) ^1.0.3
- [strip-url-auth](https://npm.io/package/strip-url-auth.md) ^1.0.1
- [pouchdb-doc-api](https://npm.io/package/pouchdb-doc-api.md) ^1.0.1
- [@hoodie/store-server](https://npm.io/package/@hoodie/store-server.md) ^3.0.0
- [@hoodie/account-server](https://npm.io/package/@hoodie/account-server.md) ^6.1.0

## Recent versions

- 23.0.0 (latest) — 2017-03-08
- 22.0.2 — 2017-01-23
- 22.0.1 — 2017-01-09
- 22.0.0 — 2017-01-05
- 21.1.4 — 2016-12-04
- 21.1.3 — 2016-11-28
- 21.1.2 — 2016-10-30
- 21.1.1 — 2016-09-13
- 21.1.0 — 2016-09-12
- 21.0.0 — 2016-09-12
- 20.0.5 — 2016-09-10
- 20.0.4 — 2016-09-09
- 20.0.3 — 2016-08-27
- 20.0.2 — 2016-08-17
- 20.0.1 — 2016-08-17
- … 7 more at https://npm.io/package/@hoodie/server/versions

## README

# hoodie-server

> Hapi plugin for Hoodie’s server core module

[![Build Status](https://travis-ci.org/hoodiehq/hoodie-server.svg?branch=master)](https://travis-ci.org/hoodiehq/hoodie-server)
[![Coverage Status](https://coveralls.io/repos/hoodiehq/hoodie-server/badge.svg?branch=master)](https://coveralls.io/github/hoodiehq/hoodie-server?branch=master)
[![Dependency Status](https://david-dm.org/hoodiehq/hoodie-server.svg)](https://david-dm.org/hoodiehq/hoodie-server)
[![devDependency Status](https://david-dm.org/hoodiehq/hoodie-server/dev-status.svg)](https://david-dm.org/hoodiehq/hoodie-server#info=devDependencies)

`@hoodie/server` integrates Hoodie’s server core modules:

- [account-server](https://github.com/hoodiehq/hoodie-account-server)
- [store-server](https://github.com/hoodiehq/hoodie-store-server)

## Example

```js
var Hapi = require('hapi')
var hoodie = require('@hoodie/server').register
var PouchDB = require('pouchdb-core').plugin(require('pouchdb-mapreduce')).plugin(require('pouchdb-adapter-memory'))

var server = new Hapi.Server()
server.connection({
  host: 'localhost',
  port: 8000
})

server.register({
  register: hoodie,
  options: { // pass options here
    PouchDB: PouchDB,
    paths: {
      public: 'dist'
    }
  }
}, function (error) {
  if (error) {
    throw error
  }

  server.start(function (error) {
    if (error) {
      throw error
    }

    console.log(('Server running at:', server.info.uri)
  })
})
```

## Usage

option                    | default      | description
------------------------- | ------------ | -------------
**adminPassword**         | -            | Password to login with admin account
**paths.data**            | `'.hoodie'`  | Data path
**paths.public**          | `'public'`   | Public path
**PouchDB**               | –            | [PouchDB constructor](https://pouchdb.com/api.html#defaults). See also [custom PouchDB builds](https://pouchdb.com/2016/06/06/introducing-pouchdb-custom-builds.html).
**account**               | `{}`         | [Hoodie Account Server](https://github.com/hoodiehq/hoodie-account-server/tree/master/plugin#options) options. `account.admins` are generated based on `adminPassword` option above. `account.usersDb` is hardcoded to `_users` at this point. `account.secret` is stored in `hoodie-store/hoodie` and will be generated if it does not yet exist.
**store**                 | `{}`         | [Hoodie Store Server](https://github.com/hoodiehq/hoodie-store-server#options) options. `store.couchdb`, `store.PouchDB` are set based on the `PouchDB` option above. `store.hooks.onPreAuth` is set to bind user authentication for Hoodie Account to Hoodie Store.

## Testing

Local setup

```
git clone https://github.com/hoodiehq/hoodie-server.git
cd hoodie-server
npm install
```

Run all tests

```
npm test
```

## Contributing

Have a look at the Hoodie project's [contribution guidelines](https://github.com/hoodiehq/hoodie/blob/master/CONTRIBUTING.md).
If you want to hang out you can join our [Hoodie Community Chat](http://hood.ie/chat/).

## License

[Apache 2.0](LICENSE)

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