Skip to content

Commit 84db69e

Browse files
committed
Initial.
0 parents  commit 84db69e

File tree

14 files changed

+453
-0
lines changed

14 files changed

+453
-0
lines changed

.editorconfig

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# editorconfig.org
2+
3+
root = true
4+
5+
[*]
6+
charset = utf-8
7+
indent_size = 2
8+
indent_style = space
9+
insert_final_newline = true
10+
trim_trailing_whitespace = true
11+
12+
[*.md]
13+
trim_trailing_whitespace = false

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text=auto eol=lf

.gitignore

Lines changed: 283 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,283 @@
1+
2+
# Created by https://www.gitignore.io/api/node,serverless
3+
# Edit at https://www.gitignore.io/?templates=node,serverless
4+
5+
### Node ###
6+
# Logs
7+
logs
8+
*.log
9+
npm-debug.log*
10+
yarn-debug.log*
11+
yarn-error.log*
12+
lerna-debug.log*
13+
14+
# Diagnostic reports (https://nodejs.org/api/report.html)
15+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
16+
17+
# Runtime data
18+
pids
19+
*.pid
20+
*.seed
21+
*.pid.lock
22+
23+
# Directory for instrumented libs generated by jscoverage/JSCover
24+
lib-cov
25+
26+
# Coverage directory used by tools like istanbul
27+
coverage
28+
29+
# nyc test coverage
30+
.nyc_output
31+
32+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
33+
.grunt
34+
35+
# Bower dependency directory (https://bower.io/)
36+
bower_components
37+
38+
# node-waf configuration
39+
.lock-wscript
40+
41+
# Compiled binary addons (https://nodejs.org/api/addons.html)
42+
build/Release
43+
44+
# Dependency directories
45+
node_modules/
46+
jspm_packages/
47+
48+
# TypeScript v1 declaration files
49+
typings/
50+
51+
# Optional npm cache directory
52+
.npm
53+
54+
# Optional eslint cache
55+
.eslintcache
56+
57+
# Optional REPL history
58+
.node_repl_history
59+
60+
# Output of 'npm pack'
61+
*.tgz
62+
63+
# Yarn Integrity file
64+
.yarn-integrity
65+
66+
# dotenv environment variables file
67+
.env
68+
.env.test
69+
70+
# parcel-bundler cache (https://parceljs.org/)
71+
.cache
72+
73+
# next.js build output
74+
.next
75+
76+
# nuxt.js build output
77+
.nuxt
78+
79+
# vuepress build output
80+
.vuepress/dist
81+
82+
# Serverless directories
83+
.serverless/
84+
85+
# FuseBox cache
86+
.fusebox/
87+
88+
# DynamoDB Local files
89+
.dynamodb/
90+
91+
### Serverless ###
92+
# Ignore build directory
93+
.serverless
94+
95+
# End of https://www.gitignore.io/api/node,serverless
96+
97+
# Created by https://www.gitignore.io/api/python
98+
# Edit at https://www.gitignore.io/?templates=python
99+
100+
### Python ###
101+
# Byte-compiled / optimized / DLL files
102+
__pycache__/
103+
*.py[cod]
104+
*$py.class
105+
106+
# C extensions
107+
*.so
108+
109+
# Distribution / packaging
110+
.Python
111+
build/
112+
develop-eggs/
113+
dist/
114+
downloads/
115+
eggs/
116+
.eggs/
117+
lib/
118+
lib64/
119+
parts/
120+
sdist/
121+
var/
122+
wheels/
123+
pip-wheel-metadata/
124+
share/python-wheels/
125+
*.egg-info/
126+
.installed.cfg
127+
*.egg
128+
MANIFEST
129+
130+
# PyInstaller
131+
# Usually these files are written by a python script from a template
132+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
133+
*.manifest
134+
*.spec
135+
136+
# Installer logs
137+
pip-log.txt
138+
pip-delete-this-directory.txt
139+
140+
# Unit test / coverage reports
141+
htmlcov/
142+
.tox/
143+
.nox/
144+
.coverage
145+
.coverage.*
146+
.cache
147+
nosetests.xml
148+
coverage.xml
149+
*.cover
150+
.hypothesis/
151+
.pytest_cache/
152+
153+
# Translations
154+
*.mo
155+
*.pot
156+
157+
# Django stuff:
158+
*.log
159+
local_settings.py
160+
db.sqlite3
161+
162+
# Flask stuff:
163+
instance/
164+
.webassets-cache
165+
166+
# Scrapy stuff:
167+
.scrapy
168+
169+
# Sphinx documentation
170+
docs/_build/
171+
172+
# PyBuilder
173+
target/
174+
175+
# Jupyter Notebook
176+
.ipynb_checkpoints
177+
178+
# IPython
179+
profile_default/
180+
ipython_config.py
181+
182+
# pyenv
183+
.python-version
184+
185+
# pipenv
186+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
187+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
188+
# having no cross-platform support, pipenv may install dependencies that don’t work, or not
189+
# install all needed dependencies.
190+
#Pipfile.lock
191+
192+
# celery beat schedule file
193+
celerybeat-schedule
194+
195+
# SageMath parsed files
196+
*.sage.py
197+
198+
# Environments
199+
.env
200+
.venv
201+
env/
202+
venv/
203+
ENV/
204+
env.bak/
205+
venv.bak/
206+
207+
# Spyder project settings
208+
.spyderproject
209+
.spyproject
210+
211+
# Rope project settings
212+
.ropeproject
213+
214+
# mkdocs documentation
215+
/site
216+
217+
# mypy
218+
.mypy_cache/
219+
.dmypy.json
220+
dmypy.json
221+
222+
# Pyre type checker
223+
.pyre/
224+
225+
# End of https://www.gitignore.io/api/python
226+
227+
228+
# Created by https://www.gitignore.io/api/macos
229+
# Edit at https://www.gitignore.io/?templates=macos
230+
231+
### macOS ###
232+
# General
233+
.DS_Store
234+
.AppleDouble
235+
.LSOverride
236+
237+
# Icon must end with two \r
238+
Icon
239+
240+
# Thumbnails
241+
._*
242+
243+
# Files that might appear in the root of a volume
244+
.DocumentRevisions-V100
245+
.fseventsd
246+
.Spotlight-V100
247+
.TemporaryItems
248+
.Trashes
249+
.VolumeIcon.icns
250+
.com.apple.timemachine.donotpresent
251+
252+
# Directories potentially created on remote AFP share
253+
.AppleDB
254+
.AppleDesktop
255+
Network Trash Folder
256+
Temporary Items
257+
.apdisk
258+
259+
# End of https://www.gitignore.io/api/macos
260+
261+
# Created by https://www.gitignore.io/api/visualstudiocode
262+
# Edit at https://www.gitignore.io/?templates=visualstudiocode
263+
264+
### VisualStudioCode ###
265+
.vscode/*
266+
!.vscode/settings.json
267+
!.vscode/tasks.json
268+
!.vscode/launch.json
269+
!.vscode/extensions.json
270+
271+
### VisualStudioCode Patch ###
272+
# Ignore all local history of files
273+
.history
274+
275+
# End of https://www.gitignore.io/api/visualstudiocod
276+
277+
### Custom ###
278+
# Ignore Lambda layers
279+
layers/
280+
layer/
281+
_diary/
282+
283+
# End of custom

.nowignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.next

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
package-lock=false

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
v8.15.0

README.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# WebPipe Block Demos
2+
3+
In this repo we're demonstrating simple but complete example blocks. Using
4+
`now.sh`, Node, and the node-webpipe server module.
5+
6+
## Examples
7+
8+
Try running a few client requests locally.
9+
10+
### DNS Lookup Block
11+
12+
In this example, we're invoking a block named `inspect-hostname-dns`. This block
13+
lets us know if a given domain name is available for purchase. So, all we have
14+
to do is provide. a hostname then the block does its work to find us answer.
15+
16+
## Example Usage
17+
18+
```sh
19+
curl -v -X OPTIONS \
20+
https://block-demos.webpipes.now.sh/inspect-hostname-dns
21+
```
22+
23+
<details>
24+
<summary>Response body is the input & output block definitions.</summary>
25+
26+
```json
27+
{
28+
"name": "DNS Lookup",
29+
"description": "Determine whether or not a hostname exists.",
30+
"inputs": [
31+
{
32+
"name": "hostname",
33+
"type": "string",
34+
"description": "A hostname to lookup."
35+
}
36+
],
37+
"outputs": [
38+
{
39+
"name": "ok",
40+
"type": "bool",
41+
"description": "Returns true of false if lookup succeeds."
42+
}
43+
]
44+
}
45+
```
46+
47+
</details>
48+
49+
```sh
50+
curl -i -X POST \
51+
-H "Content-Type: application/json" \
52+
-d '{"inputs":[{"domain":"google.com"}]}' \
53+
https://block-demos.webpipes.now.sh/inspect-hostname-dns
54+
```
55+
56+
<details>
57+
<summary>Response body should match definition described above...</summary>
58+
59+
```json
60+
{
61+
"outputs": [
62+
{
63+
"ok": true
64+
}
65+
]
66+
}
67+
```
68+
69+
Oh well, looks lke that partcular domain is already taken!
70+
71+
## Next Steps
72+
73+
Maybe spend some time examining the other demo blocks here to get a better feel
74+
for their behavior.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
const { Block } = require('node-webpipe')
2+
3+
new Block()
4+
.name('Square Root')
5+
.description('Calculates the Square Root of a number.')
6+
.input('radicand', 'number', 'The number we want to find square root for.')
7+
.output('square_root', 'number', 'The square root.')
8+
.handle(function (inputs) {
9+
return {
10+
square_root: Math.sqrt(inputs.radicand)
11+
}
12+
})
13+
.listen()

blocks/calculate-square-root/package-lock.json

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)