-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
32 lines (30 loc) · 1011 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
var marked = require('marked');
var webpipes = require('node-webpipe');
// Option 1: Chaining API
new webpipes.Block()
.name("Parse Markdown")
.description("Converts Markdown to HTML.")
.input("markdown", "string", "Markdown-formatted content for transformation.")
.output("html", "string", "HTML-converted data.")
.handle(function(inputs) {
return { html: marked(inputs.markdown) };
})
.listen();
// Option 2: Pass in block definition
// var block = new webpipes.Block({
// "name": "Parse Markdown",
// "description": "Converts Markdown to HTML.",
// "inputs": [{
// "name": "markdown",
// "type": "string",
// "description": "Markdown-formatted content for transformation."
// }],
// "outputs": [{
// "name": "html",
// "type": "string",
// "description": "HTML-converted data."
// }]
// }, function(inputs) {
// return { html: marked(inputs.markdown) };
// });
// http.createServer(block.nodeHandler()).listen(process.env.PORT || 3000);