BREAKING: merge API routes and pages concept (#53)
This commit merges API routes and pages into a single concept. The pages/api folder is now not special anymore.
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import { HandlerContext } from "../../../server.ts";
|
||||
|
||||
// Jokes courtesy of https://punsandoneliners.com/randomness/programmer-jokes/
|
||||
const JOKES = [
|
||||
"Why do Java developers often wear glasses? They can’t C#.",
|
||||
@@ -12,7 +14,7 @@ const JOKES = [
|
||||
"An SEO expert walked into a bar, pub, inn, tavern, hostelry, public house.",
|
||||
];
|
||||
|
||||
export default (_req: Request): Response => {
|
||||
export const handler = (_ctx: HandlerContext): Response => {
|
||||
const randomIndex = Math.floor(Math.random() * 10);
|
||||
const body = JOKES[randomIndex];
|
||||
return new Response(body);
|
||||
|
||||
Reference in New Issue
Block a user