Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
"use strict";
const request = require('request-promise');
module.exports = async (context, callback) => {
const gateway = process.env.gateway || 'http://gateway.openfaas:8080/';
const clientUri = `${gateway}function/wikiclient`;
const cleanupUri = `${gateway}function/markupcleanup`;
const sentimentUri = `${gateway}function/sentimentanalysis`;
const clientResponse = await request({
method: 'POST',
uri: clientUri,
body: context
});
const cleanupResponse = await request({
method: 'POST',
uri: cleanupUri,
body: clientResponse
});
const sentimentResponse = await request({
method: 'POST',
uri: sentimentUri,
body: cleanupResponse
});
callback(undefined, sentimentResponse);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment