# haute-couture

> File-based hapi plugin composer

Latest version **3.6.1** (published 2021-02-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install haute-couture
pnpm add haute-couture
yarn add haute-couture
bun add haute-couture
```

## 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 | 3.6.1 |
| Published | 2021-02-17 |
| First published | 2016-05-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=8 |
| Dependencies | 4 |
| Unpacked size | 17.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 68 |
| Author | Devin Ivy |
| Maintainers | devinivy |
| Keywords | hapi, scaffold, boilerplate, directory, structure, utility, schwifty, schmervice |

## Links

- npm: https://www.npmjs.com/package/haute-couture
- Repository: https://github.com/hapipal/haute-couture
- Homepage: https://github.com/hapipal/haute-couture#readme
- Issues: https://github.com/hapipal/haute-couture/issues
- npm.io page: https://npm.io/package/haute-couture

## Dependencies (4)

- [haute](https://npm.io/package/haute.md) >=3.1.x <4
- [@hapi/hoek](https://npm.io/package/@hapi/hoek.md) 8.x.x
- [@hapi/topo](https://npm.io/package/@hapi/topo.md) 3.x.x
- [parent-module](https://npm.io/package/parent-module.md) 2.x.x

## Alternatives

- [lodash.assign](https://npm.io/package/lodash.assign.md) — 2.3M weekly downloads
- [lodash.chunk](https://npm.io/package/lodash.chunk.md) — 1.8M weekly downloads
- [react-native-ios-utilities](https://npm.io/package/react-native-ios-utilities.md) — 138.5K weekly downloads
- [@technically/lodash](https://npm.io/package/@technically/lodash.md) — 50.9K weekly downloads
- [@fluid-topics/ft-icon](https://npm.io/package/@fluid-topics/ft-icon.md) — 20.6K weekly downloads

## Recent versions

- 3.6.1 (latest) — 2021-02-17
- 3.6.0 — 2020-08-29
- 3.5.1 — 2020-07-11
- 3.5.0 — 2020-01-13
- 3.4.0 — 2019-11-05
- 3.3.1 — 2019-04-26
- 3.3.0 — 2019-02-13
- 3.2.0 — 2019-01-20
- 3.1.0 — 2018-10-23
- 3.0.1 — 2018-04-16
- 3.0.0 — 2017-12-10
- 2.2.0 — 2017-11-07
- 2.1.0 — 2017-09-01
- 2.0.0 — 2017-03-22
- 1.5.0 — 2017-02-08
- … 5 more at https://npm.io/package/haute-couture/versions

## README

# haute-couture

File-based hapi plugin composer

[![Build Status](https://travis-ci.org/hapipal/haute-couture.svg?branch=master)](https://travis-ci.org/hapipal/haute-couture) [![Coverage Status](https://coveralls.io/repos/hapipal/haute-couture/badge.svg?branch=master&service=github)](https://coveralls.io/github/hapipal/haute-couture?branch=master)

Lead Maintainer - [Devin Ivy](https://github.com/devinivy)

## Introduction
> Note, this library is intended to work with **hapi v17+**

This library will wire your hapi plugin together based simply upon where you place files.  It has the ability to call every configuration-related method in the hapi plugin API.  This means many good things.

To name a few,

 - Route configurations placed in your `routes/` directory will be registered using `server.route()`.
 - You can place your authentication scheme in `auth/schemes.js` rather than calling `server.auth.scheme()`.
 - You can provision a cache simply by placing its configuration in `caches/my-cache-name.js`, and forget about `server.cache.provision()`.
 - Where applicable, any of these files can be configured as JSON.
 - You can teach haute-couture how to use your own custom server decorations.
 - You can still write all the custom plugin code you desire.

Again, **haute-couture** understands 19 hapi plugin methods– those for server methods, server/request decorations, request lifecycle extensions, route configuration, cookie definitions, [vision](https://github.com/hapijs/vision) view managers, [schwifty](https://github.com/hapipal/schwifty) models, [schmervice](https://github.com/hapipal/schmervice) services, and plenty more.  It can also be used as an alternative to [glue](https://github.com/hapijs/glue) for composing a server.

## Usage
> See also the [API Reference](API.md)

This library is actually not used as a hapi plugin.  Think of it instead as a useful subroutine of any hapi plugin.  The full documentation of the files and directories it recognizes can be found in the [API](API.md#files-and-directories).

Here's an example of a very simple plugin that registers a single "pinger" route.

#### `index.js`
```js
const HauteCouture = require('haute-couture');

// Either...
// 1. a plugin wired with haute-couture plus custom logic
module.exports = {
  name: 'my-hapi-plugin',
  register: async (server, options) => {

    // Do custom plugin duties

    await HauteCouture.using()(server, options);
  }
};

// 2. a plugin entirely wired using haute-couture
module.exports = {
  name: 'my-hapi-plugin',
  register: HauteCouture.using()
};
```

#### `routes/pinger.js`
```js
// Note, this could also export an array of routes
module.exports = {
  method: 'get',
  path: '/',
  options: {
    // The route id 'pinger' will be assigned
    // automatically from the filename
    handler: (request) => {

      return { ping: 'pong' };
    }
  }
};
```

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