import fsPromises from 'fs/promises' import path from 'path' import { Service, Status } from '../../interfaces/CardTypes'; export default async function ServicesAPI(req: any, res: any) { try { const filePath = path.join(process.cwd(), '/public/pages.json') const data = await fsPromises.readFile(filePath) .then((file) => JSON.parse(file.toString())); data.services.forEach((service: Service) => { service.status = Status.loading; }); res.status(200).json(data.services); } catch (error) { console.log(error); res.status(500).json({ error: 'Error reading data' }); } }