mirror of
https://github.com/supabase/supabase.git
synced 2026-07-05 17:04:33 +08:00
33 lines
882 B
TypeScript
33 lines
882 B
TypeScript
import apiWrapper from 'lib/api/apiWrapper'
|
|
import { NextApiRequest, NextApiResponse } from 'next'
|
|
|
|
export default (req: NextApiRequest, res: NextApiResponse) => apiWrapper(req, res, handler)
|
|
|
|
async function handler(req: NextApiRequest, res: NextApiResponse) {
|
|
const { method } = req
|
|
|
|
switch (method) {
|
|
case 'GET':
|
|
return handleGetAll(req, res)
|
|
default:
|
|
res.setHeader('Allow', ['GET'])
|
|
res.status(405).json({ data: null, error: { message: `Method ${method} Not Allowed` } })
|
|
}
|
|
}
|
|
|
|
const handleGetAll = async (req: NextApiRequest, res: NextApiResponse) => {
|
|
// Platform specific endpoint
|
|
const response = [
|
|
{
|
|
id: 1,
|
|
ref: 'default',
|
|
name: 'Default Project',
|
|
organization_id: 1,
|
|
cloud_provider: 'localhost',
|
|
status: 'ACTIVE_HEALTHY',
|
|
region: 'local',
|
|
},
|
|
]
|
|
return res.status(200).json(response)
|
|
}
|