Trigger shell commands via HTTP requests. Not limited to use at uberspace.
- Install dependencies
npm install
- Rename
example-config.js
toconfig.js
- Rename
example-hooks.js
tohooks.js
- Adapt config to your needs
- Start server
npm start
Create hooks by adding them to the hooks.js
'myhook': {
script: './updateMyApp.sh'
}
The script is executed on POST /hook/myhook
Property | Description |
---|---|
port | Port the server should listen on e.g. 1337 |
secret | String that needs to be sent with each request as query-param |
Assuming your webhook server runs on localhost:1337
POST http://localhost:1337/hook/myhook?secret=shhhhh
Status | Description | Response |
---|---|---|
200 OK | Shell command was executed sccessfully | {executed: true, stdout: <output_of_shell>, stderr: <err_output_of_shell>} |
404 NOT FOUND | Hook was not specified in hooks.js or secret was wrong | {executed: false, error: 'Not found'} |
404 NOT FOUND | Request URL did not match any request handlers | {executed: false, error: 'Not found'} |
500 INTERNAL SERVER ERROR | Script execution failed | {executed: false, error: <err_from_child_process>, stdout: <output_of_shell>, stderr: <err_from_script>} |