Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | 7x 6x 6x 1x 7x 5x 5x 4x 2x 1x | import type { Express } from "express";
import type { DefaultSketchStore } from "../storage";
/** Read-only: the client only loads the default sketch, so the API exposes no sketch mutations. */
export function registerSketchRoutes(app: Express, sketches: DefaultSketchStore): void {
app.get("/api/sketches", async (_req, res) => {
try {
res.json(await sketches.getAllSketches());
} catch {
res.status(500).json({ error: "Failed to fetch sketches" });
}
});
app.get("/api/sketches/:id", async (req, res) => {
try {
const sketch = await sketches.getSketch(req.params.id);
if (!sketch) return res.status(404).json({ error: "Sketch not found" });
res.json(sketch);
} catch {
res.status(500).json({ error: "Failed to fetch sketch" });
}
});
}
|