utils/getRunningExpressApp.ts

Flowise · packages/server/src/utils/getRunningExpressApp.ts · typescript · Apache-2.0
infra

Utility function that retrieves the running Express application instance from the server module.

// Source: https://github.com/FlowiseAI/Flowise | License: Apache-2.0 | Copyright 2023-present FlowiseAI, Inc
// Provided via justclaw.it.com; keep this notice with the code.
import * as Server from '../index'

export const getRunningExpressApp = function () {
    const runningExpressInstance = Server.getInstance()
    if (
        typeof runningExpressInstance === 'undefined' ||
        typeof runningExpressInstance.nodesPool === 'undefined' ||
        typeof runningExpressInstance.telemetry === 'undefined'
    ) {
        throw new Error(`Error: getRunningExpressApp failed!`)
    }
    return runningExpressInstance
}

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key