Merge pull request #3033 from shinyaohira/hapi-register

Add register definition to hapi
This commit is contained in:
Masahiro Wakame
2014-10-27 12:45:06 +09:00
2 changed files with 21 additions and 0 deletions
+20
View File
@@ -5,6 +5,26 @@ import Hapi = require('hapi');
// Create a server with a host and port
var server = Hapi.createServer('localhost', 8000);
// Add plugins
var plugin: any = {
register: function (plugin: Object, options: Object, next: Function) {
next();
}
};
plugin.register.attributes = {
name: 'test',
version: '1.0.0'
};
server.pack.register(plugin, (err: Object) => {
if (err) { throw err; }
});
server.pack.register([plugin], (err: Object) => {
if (err) { throw err; }
});
// Add the route
server.route({
method: 'GET',
+1
View File
@@ -103,6 +103,7 @@ declare module Hapi {
export class Pack {
require(name: string, options: {}, callback: Function): void;
register(plugins: any, options?: Object, callback?: Function, state?: Object): void;
}
export interface ServerView {