mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-08-26 11:12:19 +08:00
Merge pull request #3033 from shinyaohira/hapi-register
Add register definition to hapi
This commit is contained in:
@@ -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',
|
||||
|
||||
Vendored
+1
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user