How to use the bespoken-tools.BSTProxy.http function in bespoken-tools

To help you get started, we’ve selected a few bespoken-tools 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 jovotech / jovo-cli / jovo-run.js View on Github external
.action( function (webhookFile, options) {
        if(options.bstProxy) {
            const proxy = BSTProxy.http(3000);

            proxy.start(() => {
                const data = fs.readFileSync(path.join(getUserHome(), ".bst/config"));
                const bstConfig = JSON.parse(data.toString());
                const proxyURL = "https://" + bstConfig.sourceID + ".bespoken.link/webhook";
                const dashboardURL = "https://bespoken.tools/dashboard?id=" + bstConfig.sourceID + "&key=" + bstConfig.secretKey;
                let messageOutput = "Your public URL for accessing your local service:\n";
                messageOutput += proxyURL + "\n\n";
                messageOutput += "Your URL for viewing requests/responses sent to your service:\n";
                messageOutput += dashboardURL + "\n\n";
                messageOutput += "Copy and paste this to your browser to view your transaction history and summary data.\n";
                console.log(messageOutput);
            });
        }

        const localServerFile = webhookFile ? webhookFile : "index.js";
github jovotech / jovo-cli / jovo-cli / commands / run.ts View on Github external
if (args.options['disable-jovo-debugger']) {
				parameters.push('--disable-jovo-debugger');
			}

			if (args.options['model-test']) {
				parameters.push('--model-test');
			}

            if (args.options['port']) {
                parameters.push('--port');
                parameters.push(args.options['port']);
            }


            if (args.options['bst-proxy']) {
				const proxy = BSTProxy.http(port);

				proxy.start(() => {
					const data = fs.readFileSync(path.join(Utils.getUserHome(), '.bst/config'));
					const bstConfig = JSON.parse(data.toString());

					const proxyURL = 'https://' + bstConfig.sourceID + '.bespoken.link/webhook';
					const dashboardURL = 'https://bespoken.tools/dashboard?id=' + bstConfig.sourceID + '&key=' + bstConfig.secretKey;
					let messageOutput = 'Your public URL for accessing your local service:\n';
					messageOutput += proxyURL + '\n\n';
					messageOutput += 'Your URL for viewing requests/responses sent to your service:\n';
					messageOutput += dashboardURL + '\n\n';
					messageOutput += 'Copy and paste this to your browser to view your transaction history and summary data.\n';
					console.log(messageOutput);
				});
				parameters.push('--bst-proxy');
			} else {
github jovotech / jovo-cli / commands / run.js View on Github external
if (stage) {
                parameters.push('--stage');
                parameters.push(stage);
            }

            if (args.options['disable-jovo-debugger']) {
                parameters.push('--disable-jovo-debugger');
            }

            if (args.options['model-test']) {
                parameters.push('--model-test');
            }

            if (args.options['bst-proxy']) {
                const proxy = BSTProxy.http(port);

                proxy.start(() => {
                    const data = fs.readFileSync(path.join(getUserHome(), '.bst/config'));
                    const bstConfig = JSON.parse(data.toString());
                    const proxyURL = 'https://' + bstConfig.sourceID + '.bespoken.link/webhook';
                    const dashboardURL = 'https://bespoken.tools/dashboard?id=' + bstConfig.sourceID + '&key=' + bstConfig.secretKey;
                    let messageOutput = 'Your public URL for accessing your local service:\n';
                    messageOutput += proxyURL + '\n\n';
                    messageOutput += 'Your URL for viewing requests/responses sent to your service:\n';
                    messageOutput += dashboardURL + '\n\n';
                    messageOutput += 'Copy and paste this to your browser to view your transaction history and summary data.\n';
                    console.log(messageOutput);
                });
                parameters.push('--bst-proxy');
            } else if (args.options.ngrok) {
            } else {