diff --git a/mermaid/src/index.js b/mermaid/src/index.js index bb872febc..5279f6ef5 100644 --- a/mermaid/src/index.js +++ b/mermaid/src/index.js @@ -15,6 +15,14 @@ import { create } from './browser-instance.js' const worker = new Worker(browser) const server = new http.Server( micro.serve(async (req, res) => { + // Add a /health route that renders a sample diagram by calling the worker + if (req.url === '/health') { + await worker.convert(new Task('graph TD\nA-->B', false), new URLSearchParams()) + + // We don't actually care about the output, we just want to make sure the worker is up and running + return micro.send(res, 200, 'OK') + } + // TODO: add a /_status route (return mermaid version) // TODO: read the diagram source as plain text const url = new URL(req.url, 'http://localhost') // create a URL object. The base is not important here