Initial commit: code playground with multi-framework support

Express + SQLite backend with Monaco editor frontend.
Supports HTML/CSS/JS, TypeScript, React (JSX/TSX), Vue SFC,
and Svelte with live preview, console output, save/fork/share.

Includes CSS preprocessors (SCSS, Less), framework-specific
compilation (Babel, TypeScript, Svelte compiler), and
CDN-loaded runtime libraries for preview rendering.
This commit is contained in:
root
2026-02-26 08:12:39 -06:00
commit 463b563423
14 changed files with 2550 additions and 0 deletions

29
public/js/api.js Normal file
View File

@@ -0,0 +1,29 @@
const BASE = '/api/fiddles';
async function request(url, opts = {}) {
const res = await fetch(url, {
headers: { 'Content-Type': 'application/json' },
...opts,
});
if (!res.ok) {
const err = await res.json().catch(() => ({ error: res.statusText }));
throw new Error(err.error || res.statusText);
}
return res.json();
}
export function createFiddle(data) {
return request(BASE, { method: 'POST', body: JSON.stringify(data) });
}
export function loadFiddle(id) {
return request(`${BASE}/${id}`);
}
export function updateFiddle(id, data) {
return request(`${BASE}/${id}`, { method: 'PUT', body: JSON.stringify(data) });
}
export function listFiddles() {
return request(BASE);
}