simple-webhook-server/README.md
2025-04-09 10:12:22 +02:00

60 lines
No EOL
1.3 KiB
Markdown

# Simple Webhook Server
A simple server for testing webhook calls.
The server responds with every request method and logs the full data sent to the server to the console.
Example request:
```bash
curl -X POST -H "Content-Type: application/json" -d '{"foo": "bar"}' http://localhost:3000
```
Server Console:
```
2025-04-09T08:07:07.151Z - POST /
Headers: {
"host": "localhost:3000",
"user-agent": "curl/8.5.0",
"accept": "*/*",
"content-type": "application/json",
"content-length": "14"
}
Body: {
"foo": "bar"
}
```
## Usage
This currently supports running with node and docker
### Running with node
Optional: Downloading the script with curl or wget
This is not required when the whole repo has been cloned
```bash
wget https://git.eplg.services/obvtiger/simple-webhook-server/raw/branch/main/server.js
```
or
```bash
curl -o server.js https://git.eplg.services/obvtiger/simple-webhook-server/raw/branch/main/server.js
```
Then run the script
```bash
node server.js
```
The server allows the following options:
- `--port`, `-p`: The port to listen on. Default: 3000
- `--host`, `-h`: The host to bind the server to. Default: localhost
### Running with docker
```bash
docker run -p 3000:3000 git.eplg.services/obvtiger/simple-webhook-server:latest
```
You can change the port by modifying the first 3000 in the `-p` option.