A simple Express.js server with LocalTunnel integration to test webhook callbacks from third-party APIs like payment gateways, messaging platforms, and more.
- 🌐 Exposes a local server to the internet using LocalTunnel
- 📬 Logs incoming webhook requests for easy inspection
- 📄 Displays headers, body, and query parameters
- 🛠️ Easily customizable for testing different webhook payloads
- 🔁 Supports all HTTP methods (
GET,POST,PUT,DELETE, etc.)
To run this project, make sure you have the following installed:
| Requirement | Version | Description |
|---|---|---|
| Node.js | >= 14.x | JavaScript runtime to run the server |
| npm | >= 6.x | Node package manager (comes with Node.js) |
| Internet Access | Required | Needed to establish a public tunnel via LocalTunnel |
npm i webhook-test-serverInitializes and starts the Express server, and lets you define your own routes via the callback function.
| Name | Type | Description |
|---|---|---|
options |
ServerOptions |
Configuration options for starting the server (see below). |
callback |
(app: Omit<Express, "listen">) => void |
A function that receives the Express app instance (without .listen) so you can define routes using app.get, app.post, etc. |
| Option | Type | Required | Description |
|---|---|---|---|
port |
number |
✅ Yes | The local port number on which to run the server. Example: 3000 |
import { server } from "webhook-test-server";
server({ port: 3000 }, (app) => {
// Define your endpoints
app.post("/webhook", (req, res) => {
console.log("📬 Webhook received:", {
method: req.method,
headers: req.headers,
query: req.query,
body: req.body,
});
res.status(200).json({ received: true });
});
});When the server starts, it automatically uses LocalTunnel to expose your local Express server to the internet.
Once running, it logs a public URL like:
╭───────────────────────────────────────╮
│ │
│ 🚀 Server is running on: │
│ https://public-ties-test.loca.lt │
│ │
╰───────────────────────────────────────╯This project is licensed under the MIT License.