Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

added hello.ts api

supastore6ea892db7a95
diff --git a/examples/caching/with-nextjs-13/README.md b/examples/caching/with-nextjs-13/README.md
index 25fa94bde48..a71d2e3b114 100644
--- a/examples/caching/with-nextjs-13/README.md
+++ b/examples/caching/with-nextjs-13/README.md
@@ -30,6 +30,10 @@ Open [http://localhost:3000](http://localhost:3000) with your browser to see the
You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
+[API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.ts`.
+
+The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages.
+
## Learn More
To learn more about Next.js, take a look at the following resources:
diff --git a/examples/caching/with-nextjs-13/pages/api/hello.ts b/examples/caching/with-nextjs-13/pages/api/hello.ts
new file mode 100644
index 00000000000..f8bcc7e5cae
--- /dev/null
+++ b/examples/caching/with-nextjs-13/pages/api/hello.ts
@@ -0,0 +1,13 @@
+// Next.js API route support: https://nextjs.org/docs/api-routes/introduction
+import type { NextApiRequest, NextApiResponse } from 'next'
+
+type Data = {
+ name: string
+}
+
+export default function handler(
+ req: NextApiRequest,
+ res: NextApiResponse<Data>
+) {
+ res.status(200).json({ name: 'John Doe' })
+}