How to use the hyperswitch.Template function in hyperswitch

To help you get started, we’ve selected a few hyperswitch 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 wikimedia / restbase / v1 / feed.js View on Github external
'use strict';


const P = require('bluebird');
const HyperSwitch = require('hyperswitch');
const URI = HyperSwitch.URI;
const Template = HyperSwitch.Template;
const mwUtil = require('../lib/mwUtil');
const BaseFeed = require('../lib/base_feed');

const PARTS_URIS = {
    tfa: {
        reqTemplate: new Template({
            uri: '{{options.host}}/{{domain}}/v1/page/featured/{{yyyy}}/{{mm}}/{{dd}}',
            query: {
                aggregated: true
            }
        }),
        renewable: true
    },
    mostread: {
        reqTemplate: new Template({
            uri: '{{options.host}}/{{domain}}/v1/page/most-read/{{yyyy}}/{{mm}}/{{dd}}',
github wikimedia / restbase / v1 / onthisday.js View on Github external
'use strict';

const P = require('bluebird');
const HyperSwitch = require('hyperswitch');
const Template = HyperSwitch.Template;
const BaseFeed = require('../lib/base_feed');
const mwUtil = require('../lib/mwUtil');

const POSSIBLE_PARTS = [
    'selected',
    'births',
    'deaths',
    'events',
    'holidays'
];

const REQUEST_TEMPLATE = new Template({
    uri: '{{options.host}}/{{domain}}/v1/feed/onthisday/{{type}}/{{mm}}/{{dd}}'
});

class Feed extends BaseFeed {
github wikimedia / restbase / sys / action.js View on Github external
'use strict';

/*
 * Simple wrapper for the PHP action API
 */

const HyperSwitch = require('hyperswitch');
const HTTPError = HyperSwitch.HTTPError;
const Template = HyperSwitch.Template;

/**
 * Error translation
 */
const errDefs = {
    400: { status: 400, type: 'bad_request' },
    401: { status: 401, type: 'unauthorized' },
    403: { status: 403, type: 'forbidden#edit' },
    409: { status: 409, type: 'conflict' },
    413: { status: 413, type: 'too_large' },
    429: { status: 429, type: 'rate_exceeded' },
    500: { status: 500, type: 'server_error' },
    501: { status: 501, type: 'not_supported' }
};

const errCodes = {
github wikimedia / restbase / sys / backend_proxy.js View on Github external
'use strict';

const HyperSwitch = require('hyperswitch');
const Template = HyperSwitch.Template;

module.exports = (options) => {
    options = options || {};
    options.backend_host_template = options.backend_host_template || '/{domain}/sys/legacy';
    const backendURITemplate = new Template({
        uri: `${options.backend_host_template}/{{path}}`
    });
    return {
        spec: {
            paths: {
                '/{+path}': {
                    'x-route-filters': options.block_external_reqs ?
                        [{
                            type: 'default',
                            name: 'header_match',
                            options: {

hyperswitch

REST API creation framework

Apache-2.0
Latest version published 4 years ago

Package Health Score

46 / 100
Full package analysis