infra-monitoring.ts28 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 data: [],
23 yAxisLimit: 0,
24 format: '%',
25 total: 0,
26 }
27 return res.status(200).json(response)
28}