12 lines
467 B
JavaScript
12 lines
467 B
JavaScript
import PAGE from "./app.html";
|
|
|
|
export function handler(CARDS, TAGS, TITLE) {
|
|
const inject = "window.__CARDS__ = " + JSON.stringify(CARDS) + ";\n"
|
|
+ "window.__TAGS__ = " + JSON.stringify(TAGS) + ";";
|
|
const html = PAGE
|
|
.replace("__TITLE__", () => TITLE) // fn-form: no $-pattern interpretation
|
|
.replace("/*__DATA__*/", () => inject);
|
|
return new Response(html,
|
|
{ headers: { "content-type": "text/html; charset=utf-8" } });
|
|
}
|