Viewing readonly version: 69View latest version
Script
999
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/** @jsxImportSource npm:react */
import { extractProjectValInfo } from "https://esm.town/v/maxm/extractProjectValInfo";
import { renderToString } from "npm:react-dom/server";
type Handler = (r: Request) => Promise<Response> | Response;
export function Middleware(
importMetaUrl: string,
handle: Handler,
): Handler {
const projectInfo = extractProjectValInfo(importMetaUrl);
return (r: Request) => {
return landingPage(r, projectInfo);
};
// return (r: Request) => {
// return handle(r);
// };
}
function landingPage(req: Request, projectInfo: ReturnType<typeof extractProjectValInfo>) {
return new Response(
renderToString(
<html>
<head>
<title>Log Me In</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap" rel="stylesheet" />
<style>{css}</style>
</head>
<body>
<div id="root"></div>
<div className="container">
{
/* <div className="section">
<h2>Log Me In</h2>
<h3>{projectInfo.username}! Welcome to {projectInfo.projectName}.</h3>