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

hapiboot

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hapiboot

Auto load hapi modules

latest
Source
npmnpm
Version
0.2.2
Version published
Maintainers
1
Created
Source

HapiBoot

HapiBoot is a small helper library to load modules when you have a large and structured Api.

HapiBoot loads your modules from a given path and registers them as plugins. So you can easily structure your api and manage dependencies.

Install

npm install hapiboot --save

Setup

Modify your hapi start

//Load HAPI
let Hapi = require('hapi');


//Load HapiBoot
let Boot = require('hapiboot');

//Create server
const server = new Hapi.Server();

//Instantiate hapiBoot
let hapiBoot = new Boot(server, require('./config/boot.json'));

// start hapiBoot
hapiBoot.boot();

// Default hapi config and startup
server.connection({
    host: 'localhost',
    port: process.env.PORT || 3000
});

server.on('log', (event, tags) => {
    console.log(event.data);
});

// Start the server
server.start((err) => {
    if (err) throw err;
    server.log(['info', 'debug'],'Server running at: '+server.info.uri);
});

Config

Create the config file boot.json

{
  "api" : {
    "root" : "api/modules", //Define where your modules are located
  },
  "modules":[ //Define which modules should be loaded
      "helloWorldModule"
  ]
}

Keywords

Hapi

FAQs

Package last updated on 09 Jul 2016

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