diff --git a/.gitignore b/.gitignore deleted file mode 100644 index b744996..0000000 --- a/.gitignore +++ /dev/null @@ -1 +0,0 @@ -scripts diff --git a/README.md b/README.md index 4feaafb..69d31d5 100644 --- a/README.md +++ b/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. **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"} +``` diff --git a/scripts/echo b/scripts/echo new file mode 100755 index 0000000..a42b127 --- /dev/null +++ b/scripts/echo @@ -0,0 +1,8 @@ +#!/bin/bash +set -euo pipefail + +env + +echo -e "\n=====\n" + +cat -s diff --git a/scripts/test b/scripts/test new file mode 100755 index 0000000..f9ca8a5 --- /dev/null +++ b/scripts/test @@ -0,0 +1,4 @@ +#!/bin/bash +set -euo pipefail + +echo "Test success"