0.5.6 • Published 10 years ago

hapi-init v0.5.6

Weekly downloads
1
License
ISC
Repository
github
Last release
10 years ago

Hapi-Init

Synchronously call functions before other plugins, as they were some dependencies.

Options

  • tasks - an object with functions

If function returned false, then the whole process'd stop there.

Example

server.register({
	register: require('./hapi-init'),
	options: {
		tasks: {
			setConfig: function () {

				var config = {
					prod: {
						dbConnection: 'aws'
					},
					dev:
					{
						dbConnection: 'localhost'
					}
				};

				if (process.env.NODE_ENV === 'prod') {
					server.settings.app = config.prod;
				}
				else {
					server.settings.app = config.dev;
				}

			},
			sayHello: function () {
				server.log(['log'], 'hello')
			}
		}
	}
});

Install

npm install hapi-init

TODO

  • better error reporting/handling
0.5.6

10 years ago

0.5.5

10 years ago

0.5.1

10 years ago

0.5.0

10 years ago