Files
conversation-layer/mcp/lib/api.js
josedario87 7eba5b2755
All checks were successful
Deploy conversation layer / deploy (push) Successful in 6s
iniciada creacion del mcp
2025-06-06 20:51:06 -06:00

16 lines
513 B
JavaScript

export const API_BASE_URL = process.env.PLANILLA_API_URL || "http://localhost:4000";
export async function fetchJSON(path, options = {}) {
const method = options.method || "GET";
console.log(`[API] ${method} ${API_BASE_URL}${path}`);
const res = await fetch(`${API_BASE_URL}${path}`, {
headers: { "Content-Type": "application/json" },
...options,
});
if (!res.ok) {
const txt = await res.text();
throw new Error(`API request failed (${res.status}): ${txt}`);
}
return res.json();
}