@qelos/gateway
Version:
Qelos pure gateway
21 lines (20 loc) • 941 B
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const api_kit_1 = require("@qelos/api-kit");
const cache_manager_1 = __importDefault(require("./cache-manager"));
const api_proxy_middleware_1 = __importDefault(require("@qelos/api-proxy-middleware"));
(0, api_kit_1.config)({ cors: false, bodyParser: false });
const app = (0, api_kit_1.app)();
(0, api_proxy_middleware_1.default)(app, {}, cache_manager_1.default);
const port = process.env.PORT || 3000;
const address = process.env.IP || "0.0.0.0";
(0, api_kit_1.start)("Gateway", port, address)
.finally(() => {
if (process.env.NODE_ENV !== 'production') {
fetch(`http://${address}:${port}`)
.then(res => res.status < 500 ? console.log('Gateway is running on dev') : process.exit(1));
}
});