# hapi-plugin-shim

> Code your HAPI server plugins ES2017 style, and use this to present to Glue or the HAPI server.

Latest version **1.0.1** (published 2017-04-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install hapi-plugin-shim
pnpm add hapi-plugin-shim
yarn add hapi-plugin-shim
bun add hapi-plugin-shim
```

## 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 | 1.0.1 |
| Published | 2017-04-22 |
| First published | 2017-04-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=4.0.0 |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Michael Shick |
| Maintainers | mshick |
| Keywords | hapi, server, plugin, es2017, async, await, shim |

## Links

- npm: https://www.npmjs.com/package/hapi-plugin-shim
- Repository: https://github.com/mshick/hapi-plugin-shim
- Homepage: https://github.com/mshick/hapi-plugin-shim#readme
- Issues: https://github.com/mshick/hapi-plugin-shim/issues
- npm.io page: https://npm.io/package/hapi-plugin-shim

## Alternatives

- [@commercetools/sync-actions](https://npm.io/package/@commercetools/sync-actions.md) — 25.1K weekly downloads
- [cwait](https://npm.io/package/cwait.md) — 21.4K weekly downloads
- [@ledgerhq/hw-app-cosmos](https://npm.io/package/@ledgerhq/hw-app-cosmos.md) — 4.2K weekly downloads
- [@financial-times/o-loading](https://npm.io/package/@financial-times/o-loading.md) — 2.8K weekly downloads
- [fa](https://npm.io/package/fa.md) — 185 weekly downloads

## Recent versions

- 1.0.1 (latest) — 2017-04-22
- 1.0.0 — 2017-04-22

## README

# hapi-plugin-shim

[![npm version](https://badge.fury.io/js/hapi-plugin-shim.svg)](https://badge.fury.io/js/hapi-plugin-shim)

Code your HAPI server plugins ES2017 style, and use this to present to Glue or the HAPI server.

## Usage

> Your nice ES2017 `plugin.js` file, for example

```javascript
const defaults = {};

const dependency = [
  'inert'
];

const after = async function (server) {
  // Do something async
  await myAsyncOperation();

  // Do some stuff requiring inert
  server.route({
    method: 'GET',
    path: '/{path*}',
    handler: {
      directory: {
        path: `/static`,
        redirectToSlash: true,
        index: true
      }
    }
  });
};

const register = async function (server, options) {
  server.expose('options', {
    ...defaults,
    ...options
  });
};

export default {
  dependency,
  register,
  after
};
```

> And the `index.js` file you present to the HAPI-verse

```javascript
import shim from 'hapi-plugin-shim';
import pkg from './package.json';
import plugin from './plugin';

module.exports = shim({pkg, plugin});
```

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