1import type { ServerResponse } from 'http'3let isLive = false5export const markLive = () => {6 isLive = true7}9const probeHandlers: Record<string, (res: ServerResponse) => void> = {10 liveness: (res) => {11 if (isLive) {12 res.statusCode = 20013 res.end('OK')14 } else {15 res.statusCode = 50016 res.end('NOT OK')17 }18 },19}21export const handleProbe = (type: string, res: ServerResponse) => {22 const handler = probeHandlers[type]23 if (handler) {24 handler(res)25 } else {26 res.statusCode = 40427 res.end('NOT FOUND')28 }29}