index.ts 947 B

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