Skip to content

Instantly share code, notes, and snippets.

@pmichk
Created April 17, 2019 19:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pmichk/919f6b03b8e198b08238018b053d7352 to your computer and use it in GitHub Desktop.
Save pmichk/919f6b03b8e198b08238018b053d7352 to your computer and use it in GitHub Desktop.
"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