-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.ts
42 lines (34 loc) · 1.18 KB
/
main.ts
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
37
38
39
40
41
42
#!/usr/bin/env -S deno run --allow-read --allow-net --allow-env --allow-run --allow-hrtime --no-check --watch
// Copyright 2022 the Deno authors. All rights reserved. MIT license.
/// <reference no-default-lib="true" />
/// <reference lib="dom" />
/// <reference lib="dom.asynciterable" />
/// <reference lib="deno.ns" />
/// <reference lib="deno.unstable" />
import { ServerContext } from "$fresh/server.ts";
import { Fragment, h } from "preact";
import { serve } from "$std/http/server.ts";
import { router } from "$router";
import { setup } from "$doc_components/services.ts";
import manifest from "./fresh.gen.ts";
import options from "./options.ts";
await setup({
resolveHref(current, symbol) {
return symbol ? `${current}?s=${symbol}` : current;
},
lookupHref(
_current: string,
_namespace: string | undefined,
_symbol: string,
): string | undefined {
return undefined;
},
resolveSourceHref(url, line) {
return line ? `${url}?code#L${line}` : `${url}?code`;
},
runtime: { Fragment, h },
});
const ctx = await ServerContext.fromManifest(manifest, options);
const innerHandler = ctx.handler();
const handler = router({}, innerHandler);
serve(handler);