html_page Deno module
2022-05-24I have been learning about Deno lately and often in prototypes I want to serve a simple HTML page so I created this simple module which simplifies creating a basic HTMl page.
In the process I learned about how to setup a Deno Third Party Module and how to get it deployed to https://deno.land/x
import { Application, Router } from "https://deno.land/x/oak/mod.ts";
import { makeHTMLPage } from "https://deno.land/x/html_page/mod.ts";
const router = new Router();
router.get("/", async (context) => {
context.response.body = makeHTMLPage({
body: `<h1>Hello Deno 🦕</h1>`,
title: "html_page",
});
});
const app = new Application();
app.use(router.routes());
app.use(router.allowedMethods());
await app.listen({ port: 8002 });
Deno playground: https://dash.deno.com/playground/careful-weasel-51
Checkout the module here: https://deno.land/x/html_page