WebPipes are tiny HTTP programs that do one thing and do it well. They fill in the gaps. Need a proxy? Need to convert Markdown to HTML? Give a WebPipe some input, and it'll give you some output. They're a handy tool to have in your arsenal.
WebPipe.js exposes two methods: webpipe.options() and webpipe.execute().
Click run below each example to see the result. Edit the code and test it again.
This is a convenience function that returns the JSON descriptor for the WebPipe in question.
var blockURL = "http://block-parse-markdown.herokuapp.com/";
webpipe.options(blockURL, function (err, data) {
if (err) {
console.log("Error: ", err);
} else {
// Prints the webpipe.json config for the Parse Markdown webpipe.
console.log(data);
}
});
The real workhorse is webpipe.execute(). This handles the dirty work of executing a WebPipe.
var blockURL = "http://block-parse-markdown.herokuapp.com/";
webpipe.execute(blockURL, { markdown: "*hello world*" }, function (err, data) {
if (err) {
console.log("Error: ", err);
} else {
// Prints the outputs of the WebPipe.
console.log(data);
}
});