// api.js (calls Express server)
export async function createProject(data) {
const res = await fetch(`${API_URL}/api/projects`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(data)
});
return res.json();
}
// storage.js (uses localStorage)
export async function createProject(data) {
const project = { _id: generateId(), ...data, createdAt: new Date() };
const projects = getAll('projects');
projects.push(project);
saveAll('projects', projects);
return project;
}