feat: log action type
All checks were successful
Build and Push Docker Image / build (push) Successful in 42s
All checks were successful
Build and Push Docker Image / build (push) Successful in 42s
This commit is contained in:
17
src/index.ts
17
src/index.ts
@@ -1,12 +1,25 @@
|
||||
import express from "express";
|
||||
import { z } from "zod";
|
||||
import { env } from "./env";
|
||||
|
||||
const webhookSchema = z.object({
|
||||
action: z.enum(["deleted", "created"]),
|
||||
});
|
||||
|
||||
const app = express();
|
||||
|
||||
app.use(express.json());
|
||||
|
||||
app.post("/", (req, res) => {
|
||||
console.log(req);
|
||||
app.post("/", async (req, res) => {
|
||||
const result = webhookSchema.safeParse(req.body);
|
||||
if (!result.success) {
|
||||
res.sendStatus(200);
|
||||
return;
|
||||
}
|
||||
|
||||
const { action } = result.data;
|
||||
console.log(`Webhook received: ${action}`);
|
||||
|
||||
res.sendStatus(200);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user