Add web-frontend, web-project-audit and web-project-scaffold-containerized-python skills
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
59fc08fa5f
commit
5201aa9bd5
63 changed files with 3042 additions and 0 deletions
|
|
@ -0,0 +1,14 @@
|
|||
// Small fetch wrapper: JSON in, JSON out, errors carry the server's message.
|
||||
export async function getJSON(path, options = {}) {
|
||||
const response = await fetch(path, { headers: { Accept: "application/json" }, ...options });
|
||||
if (!response.ok) {
|
||||
let detail = response.statusText;
|
||||
try { detail = (await response.json()).detail ?? detail; } catch {}
|
||||
throw new Error(`${response.status} ${detail}`);
|
||||
}
|
||||
return response.json();
|
||||
}
|
||||
|
||||
export function postJSON(path, body) {
|
||||
return getJSON(path, { method: "POST", headers: { "Content-Type": "application/json", Accept: "application/json" }, body: JSON.stringify(body) });
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
// Plain ES modules, no bundler. Vendor any library into /static/vendor and import it by path.
|
||||
import { getJSON } from "./api.js";
|
||||
|
||||
const status = document.getElementById("status");
|
||||
const version = document.getElementById("version");
|
||||
|
||||
try {
|
||||
const info = await getJSON("/api/info");
|
||||
version.textContent = info.version;
|
||||
status.textContent = `Running ${info.name} at commit ${info.version}.`;
|
||||
status.className = "ok";
|
||||
} catch (err) {
|
||||
status.textContent = `Could not reach the API: ${err.message}`;
|
||||
status.className = "error";
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue