A convenient CLI tool to quickly spin up DragonflyBSD virtual machines using QEMU with sensible defaults.
1import { Hono } from "hono";
2import { Effect, pipe } from "effect";
3import { parseParams, presentation } from "./utils.ts";
4import { getImage, listImages } from "../images.ts";
5
6const app = new Hono();
7
8app.get("/", (c) =>
9 Effect.runPromise(
10 pipe(
11 listImages(),
12 presentation(c),
13 ),
14 ));
15
16app.get("/:id", (c) =>
17 Effect.runPromise(
18 pipe(
19 parseParams(c),
20 Effect.flatMap(({ id }) => getImage(id)),
21 presentation(c),
22 ),
23 ));
24
25app.post("/", (c) => {
26 return c.json({ message: "New image created" });
27});
28
29app.delete("/:id", (c) => {
30 const { id } = c.req.param();
31 return c.json({ message: `Image with ID ${id} deleted` });
32});
33
34export default app;