Skip to content

Commit fa7559d

Browse files
authored
feat: add /api/openapi.json discovery endpoint (#462)
1 parent cc77a84 commit fa7559d

3 files changed

Lines changed: 35 additions & 7 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"@stripe/stripe-js": "^8.9.0",
2626
"@vercel/blob": "^2.3.1",
2727
"mermaid": "^11.12.2",
28-
"mppx": "~0.4.2",
28+
"mppx": "https://pkg.pr.new/mppx@235",
2929
"react": "^19",
3030
"react-dom": "^19",
3131
"stripe": "^20.4.1",

pnpm-lock.yaml

Lines changed: 7 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/pages/_api/api/openapi.json.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import { discovery } from "mppx/nextjs";
2+
import { mppx } from "../../../mppx.server";
3+
4+
const USDC = "0x20c000000000000000000000b9537d11c60e8b50";
5+
6+
export const GET = discovery(mppx, {
7+
info: { title: "mpp.dev", version: "1.0.0" },
8+
routes: [
9+
{
10+
handler: mppx.charge({
11+
amount: "0.1",
12+
currency: USDC,
13+
description: "Ping endpoint access",
14+
}),
15+
method: "get",
16+
path: "/api/ping/paid",
17+
summary: "Paid ping — returns a greeting after payment",
18+
},
19+
],
20+
serviceInfo: {
21+
categories: ["web"],
22+
docs: {
23+
homepage: "https://mpp.dev",
24+
llms: "https://mpp.dev/llms.txt",
25+
},
26+
},
27+
});

0 commit comments

Comments
 (0)