1- # WebPipe Block Demos
1+ # WebPipe Examples
22
3- In this repo we're demonstrating simple but complete example blocks. Using
4- ` now.sh ` , Node, and the node-webpipe server module .
3+ > Welcome to the world's finest private collection of meticulously handcrafted
4+ > WebPipes .
55
6- ## Examples
6+ > This project is a single web service (available at
7+ > [ webpip.es] ( https://webpip.es ) ) built on top of the
8+ > [ ZEIT Now] ( https://github.com/zeit/now-examples ) cloud platform.
79
8- Try running a few client requests locally.
10+ \* Note: As of 6/8/2019, only NodeJS examples exist the moment. However,we should
11+ be able to include any Now-supported runtime.
12+
13+ ## Public Convenience API
14+
15+ As a convenience, each example is publically available at via
16+ [ webpip.es] ( https://webpip.es ) . You can check ` now.json ` for each example's HTTP
17+ pathname, but basically, the folder each lives in is also the HTTP pathname.
18+ Accordingly, you can find the ` ./api/parse-url ` example is available via
19+ ` https://webpip.es/parse-url ` :
20+
21+ ``` bash
22+ curl -v -X OPTIONS https://webpip.es/parse-url
23+ ```
24+
25+ <details >
26+ <summary >Response body is the input & output block definitions.</summary >
27+
28+ ``` json
29+ {
30+ "name" : " Parse URL" ,
31+ "description" : " Parse URL using WHATWG URL Standard." ,
32+ "inputs" : [
33+ {
34+ "name" : " url" ,
35+ "type" : " string" ,
36+ "description" : " A url to parse."
37+ }
38+ ],
39+ "outputs" : [
40+ {
41+ "name" : " parts" ,
42+ "type" : " objects" ,
43+ "description" : " Returns the parsed URL parts."
44+ }
45+ ]
46+ }
47+ ```
48+
49+ </details >
50+
51+ > _ Nice things are nice._ Please be mindful and keep your _ use_ & _ usage_
52+ > responsible. It's intended to serve primarily as a hands-on demonstration for
53+ > newcomers.
54+
55+ ## Full Example
56+
57+ Try running a few client requests locally. Just run ` node index.js ` inside the
58+ example folder, or ` now dev ` if you prefer.
59+
60+ It may be a bit easier starting with the very minimal ` calculate-square-root `
61+ WebPipe. That said, the examples aren't structured in any particular order or
62+ and don't have any sort of difficulty levels, so feel free to explore in
63+ whatever way feels most comfortable.
64+
65+ ``` bash
66+ curl -v -X OPTIONS \
67+ https://webpip.es/inspect-hostname-dns
68+ ```
69+
70+ <details >
71+ <summary >Response body is the input & output block definitions.</summary >
72+
73+ ``` json
74+ {
75+ "name" : " DNS Lookup" ,
76+ "description" : " Determine whether or not a hostname exists." ,
77+ "inputs" : [
78+ {
79+ "name" : " hostname" ,
80+ "type" : " string" ,
81+ "description" : " A hostname to lookup."
82+ }
83+ ],
84+ "outputs" : [
85+ {
86+ "name" : " ok" ,
87+ "type" : " bool" ,
88+ "description" : " Returns true of false if lookup succeeds."
89+ }
90+ ]
91+ }
92+ ```
93+
94+ </details >
995
1096### DNS Lookup Block
1197
@@ -15,7 +101,7 @@ to do is provide. a hostname then the block does its work to find us answer.
15101
16102## Example Usage
17103
18- ``` sh
104+ ``` bash
19105curl -v -X OPTIONS \
20106 https://webpip.es/inspect-hostname-dns
21107```
@@ -46,7 +132,7 @@ curl -v -X OPTIONS \
46132
47133</details >
48134
49- ``` sh
135+ ``` bash
50136curl -i -X POST \
51137 -H " Content-Type: application/json" \
52138 -d ' {"inputs":[{"domain":"google.com"}]}' \
0 commit comments