simplify code

* * *

This commit was sponsored by The Hoodie Firm.
You can hire The Hoodie Firm:
http://go.hood.ie/thehoodiefirm

* * *

This commit was sponsored by The Hoodie Firm.
You can hire The Hoodie Firm:
http://go.hood.ie/thehoodiefirm
add handler for plugins

* * *

This commit was sponsored by The Hoodie Firm.
You can hire The Hoodie Firm:
http://go.hood.ie/thehoodiefirm
add helper to list plugins's api.js files

* * *

This commit was sponsored by The Hoodie Firm.
You can hire The Hoodie Firm:
http://go.hood.ie/thehoodiefirm
add support for PUT, POST, DELETE

* * *

This commit was sponsored by The Hoodie Firm.
You can hire The Hoodie Firm:
http://go.hood.ie/thehoodiefirm
make jshint happy

* * *

This commit was sponsored by The Hoodie Firm.
You can hire The Hoodie Firm:
http://go.hood.ie/thehoodiefirm
fix paths and stuff

* * *

This commit was sponsored by The Hoodie Firm.
You can hire The Hoodie Firm:
http://go.hood.ie/thehoodiefirm
simplify

* * *

This week of work on @hoodiehq is sponsored by SpotMe.
SpotMe are the inventors of UberApp and a leading brand
in the mobile event app market, constantly working to
improve their software and services to make meetings
even better and make mobile technology a more human
experience. They love offline first, AngularJS, CouchDB,
node.js and the CAP theorem and are now searching for
talented and dedicated people to join their international
team. SpotMe wants you, e.g. Full Stack Developers and
Backend Engineers: http://go.hood.ie/spotme_hires
Introduce Server Hooks that plugins can register to be called for

If a plugin has a file `hooks.js` in it’s top level directory and
the file exports a dictionary of hook names and functions,
hoodie-server will call the function for the specified hook.

An example `hooks.js`:

```js
module.exports = {
 'server.pack.pre': function (pack) {
    console.log('hook: server.pack.pre called');
  },

  'server.pack.post': function (pack) {
    console.log('hook: server.pack.post called');
  },

  'server.api.plugin-request': function (request, reply) {
    reply({testplugin: 'works'});
  }
};
```

This patch adds three hooks:

 - `server.pack.pre`
 - `server.pack.post`
 - `server.api.plugin-requet`

The first two run before and after the `pack` setup but just
before `pack.start()`.

The last one gets called for every request to
`/_api/_plugins/<plugin-name>/_api/`

More hooks can be added easily with:

> hooks.run('name.of.hook', [hook, arguments]);

Note that the hook names and the format of hooks.js are just a
suggestion, and open for bikesheds. An alternative could be
a directory `./hooks/` inside a plugin with files:

- `server.pack.pre.js`,
- `server.pack.post.js`,
- `server.api.plugin-request.js`

and so on. Each would include a single exported function.

* * *

This week of work on @hoodiehq is sponsored by SpotMe.
SpotMe are the inventors of UberApp and a leading brand
in the mobile event app market, constantly working to
improve their software and services to make meetings
even better and make mobile technology a more human
experience. They love offline first, AngularJS, CouchDB,
node.js and the CAP theorem and are now searching for
talented and dedicated people to join their international
team. SpotMe wants you, e.g. Full Stack Developers and
Backend Engineers: http://go.hood.ie/spotme_hires
[package.json] remove testing value

* * *

This week of work on @hoodiehq is sponsored by SpotMe.
SpotMe are the inventors of UberApp and a leading brand
in the mobile event app market, constantly working to
improve their software and services to make meetings
even better and make mobile technology a more human
experience. They love offline first, AngularJS, CouchDB,
node.js and the CAP theorem and are now searching for
talented and dedicated people to join their international
team. SpotMe wants you, e.g. Full Stack Developers and
Backend Engineers: http://go.hood.ie/spotme_hires
we use lodash now, not underscore

* * *

This week of work on @hoodiehq is sponsored by SpotMe.
SpotMe are the inventors of UberApp and a leading brand
in the mobile event app market, constantly working to
improve their software and services to make meetings
even better and make mobile technology a more human
experience. They love offline first, AngularJS, CouchDB,
node.js and the CAP theorem and are now searching for
talented and dedicated people to join their international
team. SpotMe wants you, e.g. Full Stack Developers and
Backend Engineers: http://go.hood.ie/spotme_hires