index.ts34 lines · main
1import { NextApiRequest, NextApiResponse } from 'next'
2
3import apiWrapper from '@/lib/api/apiWrapper'
4
5export default (req: NextApiRequest, res: NextApiResponse) => apiWrapper(req, res, handler)
6
7async function handler(req: NextApiRequest, res: NextApiResponse) {
8 const { method } = req
9
10 switch (method) {
11 case 'GET':
12 return handleGetAll(req, res)
13 default:
14 res.setHeader('Allow', ['GET'])
15 res.status(405).json({ data: null, error: { message: `Method ${method} Not Allowed` } })
16 }
17}
18
19const handleGetAll = async (_req: NextApiRequest, res: NextApiResponse) => {
20 // Platform specific endpoint
21 const response = [
22 {
23 id: 1,
24 name: process.env.DEFAULT_ORGANIZATION_NAME || 'Default Organization',
25 slug: 'default-org-slug',
26 billing_email: 'billing@supabase.co',
27 plan: {
28 id: 'enterprise',
29 name: 'Enterprise',
30 },
31 },
32 ]
33 return res.status(200).json(response)
34}