link-stack/apps/bridge-frontend/app/_lib/routing.ts
2024-04-29 17:27:25 +02:00

17 lines
656 B
TypeScript

import { NextRequest, NextResponse } from "next/server";
import { getService } from "./utils";
const notFound = () => new NextResponse(null, { status: 404 });
export const getOneBot = async (req: NextRequest): Promise<NextResponse> =>
notFound();
export const sendMessage = async (req: NextRequest): Promise<NextResponse> =>
getService(req)?.sendMessage(req) ?? notFound();
export const receiveMessages = async (
req: NextRequest,
): Promise<NextResponse> => getService(req)?.receiveMessages(req) ?? notFound();
export const handleWebhook = async (req: NextRequest): Promise<NextResponse> =>
getService(req)?.handleWebhook(req) ?? notFound();