Created
April 17, 2019 19:29
-
-
Save pmichk/919f6b03b8e198b08238018b053d7352 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"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