export default async function handler(req, res) { const { 0: path } = req.query; const backendUrl = `http://localhost:3501/${path}`; const response = await fetch(backendUrl, { method: req.method, headers: { 'Content-Type': 'application/json', ...(req.headers.authorization ? { Authorization: req.headers.authorization } : {}), }, body: req.method !== 'GET' && req.method !== 'HEAD' ? JSON.stringify(req.body) : undefined, }); const data = await response.json(); res.status(response.status).json(data); }