mirror of
https://github.com/Luzifer/local-functions.git
synced 2024-09-20 02:53:01 +00:00
Add example scripts / README example
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
89916ea9b5
commit
06c38a3a97
1
.gitignore
vendored
1
.gitignore
vendored
@ -1 +0,0 @@
|
|||||||
scripts
|
|
16
README.md
16
README.md
@ -9,3 +9,19 @@
|
|||||||
`local-functions` is intended as the opposite of Cloud-Functions: Run scripts on the local machine through HTTP calls.
|
`local-functions` is intended as the opposite of Cloud-Functions: Run scripts on the local machine through HTTP calls.
|
||||||
|
|
||||||
**Be aware:** This will expose scripts in a certain folder on your machine. This might cause trouble for you! So you really should only expose the server on **localhost** and ensure nobody else is able to access the API.
|
**Be aware:** This will expose scripts in a certain folder on your machine. This might cause trouble for you! So you really should only expose the server on **localhost** and ensure nobody else is able to access the API.
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
```console
|
||||||
|
# curl -d '{"test": "foo"}' -H 'Content-Type: application/json' -X POST localhost:3000/echo
|
||||||
|
PWD=/home/luzifer/workspaces/private/go/src/github.com/Luzifer/local-functions
|
||||||
|
ACCEPT=*/*
|
||||||
|
SHLVL=1
|
||||||
|
CONTENT_TYPE=application/json
|
||||||
|
METHOD=POST
|
||||||
|
_=/usr/bin/env
|
||||||
|
|
||||||
|
=====
|
||||||
|
|
||||||
|
{"test": "foo"}
|
||||||
|
```
|
||||||
|
8
scripts/echo
Executable file
8
scripts/echo
Executable file
@ -0,0 +1,8 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
env
|
||||||
|
|
||||||
|
echo -e "\n=====\n"
|
||||||
|
|
||||||
|
cat -s
|
4
scripts/test
Executable file
4
scripts/test
Executable file
@ -0,0 +1,4 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
echo "Test success"
|
Loading…
Reference in New Issue
Block a user