Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/oleskiewicz/httpipe
http <-> stdio bridge
https://github.com/oleskiewicz/httpipe
faas go http
Last synced: about 2 months ago
JSON representation
http <-> stdio bridge
- Host: GitHub
- URL: https://github.com/oleskiewicz/httpipe
- Owner: oleskiewicz
- License: gpl-3.0
- Created: 2021-03-27T20:50:44.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2023-10-13T17:05:03.000Z (about 1 year ago)
- Last Synced: 2024-09-27T07:47:27.109Z (4 months ago)
- Topics: faas, go, http
- Language: Go
- Homepage:
- Size: 148 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
httpipe
=======
http <-> stdio bridge inspired by .![meme kiss http stdio](./meme.jpg)
Summary
-------
- each function gets a subdirectory
- on GET request, it displays a `doc` file
- on POST request, it runs `handle` executable
- `handle` reads HTTP request body as stdin
- anything that `handle` writes to stdout is sent as HTTP response
- anything that `handle` writes to stderr is appended to `log` file with a timestamp
- every invocation increments `runs` file with a timestampExtras
------
- caching of (md5-checksummed) input can be handled by `contrib/memoize` script
- piping works by calling `/pipe/{funcs}` endpoint
- you can spawn a container for process by replacing normal shebang with `contrib/cr`Example
-------
Invoke:$ envdir ./env ./httpipe # or...
$ HTTPIPE_DIR=fn ./httpipe # or...
$ ./httpipe -d fnThe simplest use case is with strings:
$ cat ./fn/b64e/handle
#!/bin/sh -e
base64$ curl -d "hello world" 0.0.0.0:8080/b64e
aGVsbG8gd29ybGQ=$ curl -d "aGVsbG8gd29ybGQ=" 0.0.0.0:8080/b64d
hello world%$ curl -d "hello world=" 0.0.0.0:8080/pipe/b64e/b64d
hello world%$ cat ./fn/bw/handle
#!/bin/sh -e
convert - -grayscale Rec709Luminance fd:1$ curl --data-binary @./meme.jpg 0.0.0.0:8080/bw > meme_bw.jpg # or...
$ < ./meme.jpg curl --data-binary @- 0.0.0.0:8080/bw > ./meme_bw.jpg