From 63ae22408467db6c86628a0ef3bf3d80f26a7e54 Mon Sep 17 00:00:00 2001 From: CyberL1 Date: Tue, 14 Jan 2025 15:01:20 -0500 Subject: [PATCH] fix(server): expose container stats --- src/routes/containers/_id/stats.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 src/routes/containers/_id/stats.ts diff --git a/src/routes/containers/_id/stats.ts b/src/routes/containers/_id/stats.ts new file mode 100644 index 0000000..d514118 --- /dev/null +++ b/src/routes/containers/_id/stats.ts @@ -0,0 +1,10 @@ +import type { Container } from "#src/types/Container.ts"; +import { getContainer } from "#src/utils/containers.ts"; +import type { FastifyInstance, FastifyRequest } from "fastify"; + +export default (fastify: FastifyInstance) => { + fastify.get("/", (req: FastifyRequest<{ Params: Container }>) => { + const container = getContainer(req.params.id); + return container.stats(); + }); +};