Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
@skava/graphql / dist / index.js
Size: Mime:
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const portscanner_1 = __importDefault(require("portscanner"));
const app_1 = require("./app");
exports.schema = app_1.schema;
/**
 * is happening 2x...
 */
function startStandalone() {
    if (process.env.IS_STANDALONE_GRAPHQL) {
        console.log('[uxui-graphql] creating app...');
        const app = app_1.createApp();
        console.log('[uxui-graphql] about to listen...');
        const port = process.env.PORT || '4000';
        const host = process.env.HOST || 'localhost';
        // if (isPortFree(port)) {
        //   const listener = app.listen(parseInt(process.env.PORT, 10) || 4000, () => {
        //     console.log('[uxui-graphql] listening on port 4000')
        //   })
        //   console.log('[uxui-graphql] async after listening')
        //   process.on('SIGTERM', () => {
        //     console.log('[uxui-graphql] SIGTERM')
        //     listener.close()
        //   })
        // }
        portscanner_1.default.checkPortStatus(port, (err, status) => {
            if (err) {
                console.error(err);
            }
            if (status === 'closed') {
                const listener = app.listen(parseInt(port, 10), host, () => {
                    console.log('[uxui-graphql] listening on port 4000');
                });
                console.log('[uxui-graphql] async after listening');
                process.on('SIGTERM', () => {
                    console.log('[uxui-graphql] SIGTERM');
                    listener.close();
                });
            }
        });
    }
    else {
        console.log('[uxui-graphql] NOT standalone');
    }
}
exports.startStandalone = startStandalone;
startStandalone();
//# sourceMappingURL=index.js.map