jovo-framework
Version:
[](https://www.jovo.tech)
34 lines • 994 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
class GoogleCloudFunction {
constructor(req, res) {
this.hasWriteFileAccess = false;
this.req = req;
this.res = res;
this.headers = req.headers;
this.$request = req.body;
}
getRequestObject() {
return this.$request;
}
setResponse(obj) {
return new Promise((resolve) => {
this.res.json(obj);
resolve();
});
}
fail(error) {
if (this.res.headersSent === false) {
const responseObj = {
code: 500,
msg: error.message,
};
if (process.env.NODE_ENV === 'production') {
responseObj.stack = error.stack;
}
this.res.status(500).json(responseObj);
}
}
}
exports.GoogleCloudFunction = GoogleCloudFunction;
//# sourceMappingURL=GoogleCloudFunction.js.map
;