This commit is contained in:
Michael Wolf
2025-03-07 15:23:38 -06:00
parent d48a533d42
commit c19e6a9537

View File

@@ -3,14 +3,20 @@
import { sleep } from "https://deno.land/x/sleep/mod.ts"; import { sleep } from "https://deno.land/x/sleep/mod.ts";
import { HttpCode, httpCodes } from "./http-codes.ts"; import { HttpCode, httpCodes } from "./http-codes.ts";
import { ContentType, contentTypes } from "./content-types"; import { ContentType, contentTypes } from "./content-types.ts";
import { services } from "./services"; import { services } from "./services.ts";
import {DenoRequest, Handler, Response, Method, UserRequest, Request, Route, ProcessedRoute } from './types.ts' import {
DenoRequest,
Handler,
Method,
ProcessedRoute,
Request,
Response,
Route,
UserRequest,
} from "./types.ts";
const phandler: Handler = async (_req: Request) => {
const phandler: Handler = async (req: Request) => {
const code = httpCodes.success.OK; const code = httpCodes.success.OK;
return { return {
code, code,
@@ -19,8 +25,6 @@ const phandler: Handler = async (req: Request) => {
}; };
}; };
// FIXME: Obviously put this somewhere else // FIXME: Obviously put this somewhere else
const okText = (out: string) => { const okText = (out: string) => {
const code = httpCodes.success.OK; const code = httpCodes.success.OK;
@@ -37,9 +41,10 @@ const routes: Route[] = [
path: "/slow", path: "/slow",
methods: ["get"], methods: ["get"],
handler: async (_req) => { handler: async (_req) => {
console.log("starting slow request") ; console.log("starting slow request");
await sleep(10); await sleep(10);
console.log("finishing slow request"); return okText("that was slow"); console.log("finishing slow request");
return okText("that was slow");
}, },
}, },
{ {
@@ -91,11 +96,4 @@ const routes: Route[] = [
}, },
]; ];
export { routes };
export {routes}