Move handler into a different file

This commit is contained in:
Michael Wolf
2025-03-07 21:46:19 -06:00
parent 72284505a0
commit 553cd680dc
2 changed files with 21 additions and 10 deletions

View File

@@ -5,6 +5,7 @@ import { sleep } from "https://deno.land/x/sleep/mod.ts";
import { HttpCode, httpCodes } from "./http-codes.ts";
import { ContentType, contentTypes } from "./content-types.ts";
import { services } from "./services.ts";
import { multiHandler } from "./handlers.ts";
import {
DenoRequest,
Handler,
@@ -62,16 +63,7 @@ const routes: Route[] = [
{
path: "/ok",
methods: ["GET", "POST", "PUT"],
handler: (req: Request) => {
const code = httpCodes.success.OK;
const rn = services.random.randomNumber();
return {
code,
result: `that was ${req.method} (${rn})`,
contentType: contentTypes.text.plain,
};
},
handler: multiHandler,
},
{
path: "/alsook",