New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

hapi-setup-helpers

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hapi-setup-helpers

hapi helpers for app setup

latest
Source
npmnpm
Version
0.2.3
Version published
Maintainers
1
Created
Source

hapi-setup-helpers

hapi helpers for app setup. work with hapi 8.x

installation

npm install --save hapi-setup-helpers

usage

var helper = require('hapi-setup-helpers')(server);

loadPlugin()

a helper method to allow loading plugins in application start synchronous with async.series for example.

Usage:

async.series([
  // load hapi-auth-cookie plugin
  helper.loadPlugin(server, 'hapi-auth-cookie', {}, function(next) {
    server.auth.strategy('session', 'cookie', {
      password: 'i wear no pants',
      cookie: 'tbsid',
      redirectTo: '/login',
      isSecure: false
    });
    next();
  }),

  // .. load more plugins
])

pluginErrorAsyncCallback()

Small helper to print error message on failures, or ok on success, print out colors.

loadRouteTable()

Helper to load Routes as a table.

One line has the following fields:

  • Method(s)
  • Path
  • Handler
    • file
    • directory
    • handler
    • toothache
    • bedwetter
  • Target for handler
  • Is this route protected?

Usage:

helper.loadRouteTable(server, [
    // file handler
    ["GET",           "/",                     "file",      "index.html",      true],
    // javascript handler, supports with multiple methods
    [["GET","POST"],  "/login",                "handler",   "login",           "login"],
    // last parameter indicates that this resource is protected 
    ["GET",           "/logout",               "handler",   "logout",          true],
    // directory handler
    ["GET",           "/{param*}",             "directory", "./",              false],
    // toothache handler
    ["GET",           "/api/contacts",         "toothache", "Contacts.find",   true]
    // load more routes
]);

Keywords

hapi

FAQs

Package last updated on 08 Feb 2015

Did you know?

Socket

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