How to use the bespoken-tools.BSTProxy 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 / commands / run.js View on Github external
#!/usr/bin/env node
'use strict';
const BSTProxy = require('bespoken-tools').BSTProxy;
const fs = require('fs');
const path = require('path');
const spawn = require('cross-spawn');
const resolveBin = require('resolve-bin');
const http = require('http');
const io = require('socket.io-client');
const Helper = require('./../helper/lmHelper');
const _ = require('lodash');
const querystring = require('querystring');
/**
 * Returns path to home directory
 * @return {string}
 */
function getUserHome() {
    return process.env[(process.platform === 'win32') ? 'USERPROFILE' : 'HOME'];
}
github jovotech / jovo-cli / jovo-run.js View on Github external
#!/usr/bin/env node
'use strict';
const program = require('commander');
const childProcess = require('child_process');
const BSTProxy = require('bespoken-tools').BSTProxy;
const fs = require("fs");
const path = require("path");
const spawn = require('cross-spawn');
function getUserHome() {
    return process.env[(process.platform === "win32") ? "USERPROFILE" : "HOME"];
}
program
    .description("Runs the jovo app.")
    .option('-h, --http', 'Creates http webhook endpoint (default)')
    .option('-b, --bst-proxy', 'Proxies the HTTP service running at the specified port via bst')
    .option('-w, --watch', 'Uses nodemon to watch files. Restarts immediately on file change.')
    .action( function (webhookFile, options) {
        if(options.bstProxy) {
            const proxy = BSTProxy.http(3000);

            proxy.start(() => {