fix: various issues arising from oak removal (#23)
This commit is contained in:
+5
-10
@@ -61,11 +61,6 @@ async function init(directory: string) {
|
||||
import.meta.url,
|
||||
)}";\n`;
|
||||
await Deno.writeTextFile(join(directory, "deps.ts"), DEPS_TS);
|
||||
const API_DEPS_TS = `export * from "${new URL(
|
||||
"../../server.ts",
|
||||
import.meta.url,
|
||||
)}";\n`;
|
||||
await Deno.writeTextFile(join(directory, "api_deps.ts"), API_DEPS_TS);
|
||||
const PAGES_INDEX_TSX = `import { h, IS_BROWSER, useState } from "../deps.ts";
|
||||
|
||||
export default function Home() {
|
||||
@@ -112,9 +107,8 @@ export default function Greet(props: Props) {
|
||||
join(directory, "pages", "[name].tsx"),
|
||||
PAGES_GREET_TSX,
|
||||
);
|
||||
const PAGES_API_JOKE_TS = `import { oak } from "../../api_deps.ts";
|
||||
|
||||
// Jokes courtesy of https://punsandoneliners.com/randomness/programmer-jokes/
|
||||
const PAGES_API_JOKE_TS =
|
||||
`// Jokes courtesy of https://punsandoneliners.com/randomness/programmer-jokes/
|
||||
const JOKES = [
|
||||
"Why do Java developers often wear glasses? They can’t C#.",
|
||||
"A SQL query walks into a bar, goes up to two tables and says “can I join you?",
|
||||
@@ -128,9 +122,10 @@ const JOKES = [
|
||||
"An SEO expert walked into a bar, pub, inn, tavern, hostelry, public house.",
|
||||
];
|
||||
|
||||
export default (ctx: oak.Context) => {
|
||||
export default (_req: Request): Response => {
|
||||
const randomIndex = Math.floor(Math.random() * 10);
|
||||
ctx.response.body = JOKES[randomIndex];
|
||||
const body = JOKES[randomIndex];
|
||||
return new Response(body);
|
||||
};
|
||||
`;
|
||||
await Deno.writeTextFile(
|
||||
|
||||
Reference in New Issue
Block a user