How to use the @podium/utils.pathnameBuilder function in @podium/utils

To help you get started, we’ve selected a few @podium/utils 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 podium-lib / podlet / example / misc-app-servers / hapi-plugin.js View on Github external
method: (request, h) => {
                const response = request.response.output
                    ? request.response.output
                    : request.response;
                response.headers['podlet-version'] = podlet.version;
                return h.continue;
            },
        });

        // Decorate response with .podiumSend() method
        server.decorate('toolkit', 'podiumSend', fragment => {
            return this.request.app.podium.render(fragment);
        });

        // Mount proxy route
        const pathname = utils.pathnameBuilder(
            podlet._proxy.pathname,
            podlet._proxy.prefix,
            '/{path*}',
        );
        server.route([
            {
                method: '*',
                path: pathname,
                handler: async request => {
                    await podlet._proxy.process(request.app.podium);
                    return '';
                },
            },
        ]);
    }
};
github podium-lib / podlet / lib / podlet.js View on Github external
[_sanitize](uri, prefix = false) {
        const pathname = prefix ? this._pathname : '';
        if (uri) {
            return utils.uriIsRelative(uri)
                ? utils.pathnameBuilder(pathname, uri)
                : uri;
        }
        return uri;
    }
github podium-lib / podlet / lib / podlet.js View on Github external
enumerable: true,
            value: new Proxy({
                pathname: this._pathname,
                logger: this.log,
            }),
        });

        Object.defineProperty(this, 'baseContext', {
            value: {
                debug: 'false',
                locale: 'en-US',
                deviceType: 'desktop',
                requestedBy: this.name,
                mountOrigin: '',
                mountPathname: this._pathname,
                publicPathname: pathnameBuilder(
                    this.httpProxy.pathname,
                    this.httpProxy.prefix,
                    this.name,
                ),
            },
            writable: false,
        });

        Object.defineProperty(this, 'defaultContext', {
            value: {},
            writable: true,
        });

        Object.defineProperty(this, 'metrics', {
            enumerable: true,
            value: new Metrics(),

@podium/utils

Common generic utility methods shared by @podium modules.

MIT
Latest version published 13 days ago

Package Health Score

78 / 100
Full package analysis