Add register definition to hapi

This commit is contained in:
Shinya Ohira
2014-10-26 23:53:24 +09:00
parent bd9a1922e4
commit d37305a75c
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 {