How to use @hapi/call - 3 common examples

To help you get started, we’ve selected a few @hapi/call examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hapijs / hapi / lib / core.js View on Github external
this.caches = new Map();                                                        // Cache clients
        this.compression = new Compression();
        this.controlled = null;                                                         // Other servers linked to the phases of this server
        this.decorations = { handler: [], request: [], server: [], toolkit: [] };       // Public decoration names
        this.dependencies = [];                                                         // Plugin dependencies
        this.events = new Podium(internals.events);
        this.heavy = new Heavy(this.settings.load);
        this.instances = new Set();
        this.methods = new Methods(this);                                               // Server methods
        this.mime = new Mimos(this.settings.mime);
        this.onConnection = null;                                                       // Used to remove event listener on stop
        this.plugins = {};                                                              // Exposed plugin properties by name
        this.registrations = {};                                                        // Tracks plugin for dependency validation { name -> { version } }
        this.registring = 0;                                                            // > 0 while register() is waiting for plugin callbacks
        this.requestCounter = { value: internals.counter.min, min: internals.counter.min, max: internals.counter.max };
        this.router = new Call.Router(this.settings.router);
        this.phase = 'stopped';                                                         // 'stopped', 'initializing', 'initialized', 'starting', 'started', 'stopping', 'invalid'
        this.sockets = null;                                                            // Track open sockets for graceful shutdown
        this.actives = new WeakMap();                                                   // Active requests being processed
        this.started = false;
        this.states = new Statehood.Definitions(this.settings.state);
        this.toolkit = new Toolkit.Manager();

        this.extensionsSeq = 0;                                                         // Used to keep absolute order of extensions based on the order added across locations
        this.extensions = {
            server: {
                onPreStart: new Ext('onPreStart', this),
                onPostStart: new Ext('onPostStart', this),
                onPreStop: new Ext('onPreStop', this),
                onPostStop: new Ext('onPostStop', this)
            },
            route: {
github hapipal / tandy / lib / index.js View on Github external
remove   : require('./actions/remove')
};

internals.defaults = {
    actAsUser: false,
    userUrlPrefix: 'user', // this is in the url in lieu of /users/{id}
    userModel: 'Users', // since it's not in the url
    userIdProperty: 'id', // on auth credentials
    prefix: '',
    _private: {
        actAsUserModifiedPath: false,
        count: false
    }
};

internals.Router = new Call.Router({});

internals.determineTandy = (route, thisRouteOpts) => {

    const method = route.method;
    let path = route.path;

    path = internals.normalizePath(path, thisRouteOpts);
    const pathInfo = internals.Router.analyze(path);
    const pathSegments = pathInfo.segments.length;
    let err;

    let countIsOkay = false;
    let tandy;

    switch (method) {
github hapijs / nes / lib / listener.js View on Github external
exports = module.exports = internals.Listener = function (server, settings) {

    this._server = server;
    this._settings = settings;
    this._sockets = new internals.Sockets(this);
    this._router = new Call.Router();
    this._authRoute = this._settings.auth && this._server.lookup(this._settings.auth.id);
    this._socketCounter = internals.counter.min;
    this._heartbeat = null;
    this._beatTimeout = null;
    this._stopped = false;

    // WebSocket listener

    const options = { server: this._server.listener };
    if (settings.origin) {
        options.verifyClient = (info) => settings.origin.indexOf(info.origin) >= 0;
    }

    this._wss = new Ws.Server(options);

    this._wss.on('connection', (ws, req) => {

@hapi/call

HTTP Router

BSD-3-Clause
Latest version published 2 years ago

Package Health Score

71 / 100
Full package analysis

Popular @hapi/call functions