Teach handler to accept various methods

This commit is contained in:
Michael Wolf
2025-03-07 21:29:38 -06:00
parent ecdbedc135
commit 72284505a0

View File

@@ -61,14 +61,14 @@ const routes: Route[] = [
}, },
{ {
path: "/ok", path: "/ok",
methods: ["GET"], methods: ["GET", "POST", "PUT"],
handler: (_req: Request) => { handler: (req: Request) => {
const code = httpCodes.success.OK; const code = httpCodes.success.OK;
const rn = services.random.randomNumber(); const rn = services.random.randomNumber();
return { return {
code, code,
result: "it is ok " + rn, result: `that was ${req.method} (${rn})`,
contentType: contentTypes.text.plain, contentType: contentTypes.text.plain,
}; };
}, },