serverless/lib/plugins/run/utils/eventGatewayRunning.js
2017-08-03 20:40:24 +07:00

17 lines
411 B
JavaScript

'use strict';
const fetch = require('node-fetch');
const BbPromise = require('bluebird');
function eventGatewayRunning(eventGatewayRootUrl) {
const eventGatewayStatusEndpoint = `${eventGatewayRootUrl}/v1/status`;
return fetch(eventGatewayStatusEndpoint, {
method: 'GET',
timeout: 1000,
}).then(res => res.ok)
.catch(() => BbPromise.resolve(false));
}
module.exports = eventGatewayRunning;