MCPcopy Create free account
hub / github.com/hapijs/hapi / constructor

Method constructor

lib/server.js:29–86  ·  view source on GitHub ↗
(core, name, parent)

Source from the content-addressed store, hash-verified

27internals.Server = class {
28
29 constructor(core, name, parent) {
30
31 this._core = core;
32
33 // Public interface
34
35 this.app = core.app;
36 this.auth = core.auth.public(this);
37 this.decorations = core.decorations.public;
38 this.cache = internals.cache(this);
39 this.events = core.events;
40 this.info = core.info;
41 this.listener = core.listener;
42 this.load = core.heavy.load;
43 this.methods = core.methods.methods;
44 this.mime = core.mime;
45 this.plugins = core.plugins;
46 this.registrations = core.registrations;
47 this.settings = core.settings;
48 this.states = core.states;
49 this.type = core.type;
50 this.version = Package.version;
51
52 this.realm = {
53 _extensions: {
54 onPreAuth: new Ext('onPreAuth', core),
55 onCredentials: new Ext('onCredentials', core),
56 onPostAuth: new Ext('onPostAuth', core),
57 onPreHandler: new Ext('onPreHandler', core),
58 onPostHandler: new Ext('onPostHandler', core),
59 onPreResponse: new Ext('onPreResponse', core),
60 onPostResponse: new Ext('onPostResponse', core)
61 },
62 modifiers: {
63 route: {}
64 },
65 parent: parent ? parent.realm : null,
66 plugin: name,
67 pluginOptions: {},
68 plugins: {},
69 _rules: null,
70 settings: {
71 bind: undefined,
72 files: {
73 relativeTo: undefined
74 }
75 },
76 validator: null
77 };
78
79 // Decorations
80
81 for (const [property, method] of core.decorations.server.entries()) {
82 this[property] = method;
83 }
84
85 core.registerServer(this);
86 }

Callers

nothing calls this directly

Calls 2

publicMethod · 0.80
registerServerMethod · 0.80

Tested by

no test coverage detected