Socket
Socket
Sign inDemoInstall

hapi-plugin-shim

Package Overview
Dependencies
0
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    hapi-plugin-shim

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


Version published
Maintainers
1
Install size
4.26 kB
Created

Readme

Source

hapi-plugin-shim

npm version

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

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

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

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

Keywords

FAQs

Last updated on 22 Apr 2017

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc