tambahan
This commit is contained in:
@@ -9,6 +9,7 @@ import type { User } from "generated/prisma";
|
|||||||
import WaRoute from "./server/routes/wa_route";
|
import WaRoute from "./server/routes/wa_route";
|
||||||
import WebhookRoute from "./server/routes/webhook_route";
|
import WebhookRoute from "./server/routes/webhook_route";
|
||||||
import cors from "@elysiajs/cors";
|
import cors from "@elysiajs/cors";
|
||||||
|
import WaHookRoute from "./server/routes/wa_hook_route";
|
||||||
|
|
||||||
const Docs = new Elysia().use(
|
const Docs = new Elysia().use(
|
||||||
Swagger({
|
Swagger({
|
||||||
@@ -33,7 +34,8 @@ const Api = new Elysia({
|
|||||||
.use(Dashboard)
|
.use(Dashboard)
|
||||||
.use(ApiUser)
|
.use(ApiUser)
|
||||||
.use(WaRoute)
|
.use(WaRoute)
|
||||||
.use(WebhookRoute);
|
.use(WebhookRoute)
|
||||||
|
.use(WaHookRoute);
|
||||||
|
|
||||||
const app = new Elysia()
|
const app = new Elysia()
|
||||||
.use(cors())
|
.use(cors())
|
||||||
|
|||||||
24
src/server/routes/wa_hook_route.ts
Normal file
24
src/server/routes/wa_hook_route.ts
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
import Elysia, { t } from "elysia";
|
||||||
|
|
||||||
|
const WaHookRoute = new Elysia({
|
||||||
|
prefix: "/wa-hook",
|
||||||
|
tags: ["WhatsApp Hook"],
|
||||||
|
})
|
||||||
|
|
||||||
|
.post("/hook", async (ctx) => {
|
||||||
|
const { body } = ctx.body;
|
||||||
|
|
||||||
|
console.log(body);
|
||||||
|
return {
|
||||||
|
success: true,
|
||||||
|
message: "WhatsApp Hook received"
|
||||||
|
};
|
||||||
|
}, {
|
||||||
|
body: t.Any(),
|
||||||
|
detail: {
|
||||||
|
summary: "WhatsApp Hook",
|
||||||
|
description: "WhatsApp Hook",
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
export default WaHookRoute;
|
||||||
Reference in New Issue
Block a user