2023-10-05 09:00:51 +00:00
|
|
|
import { route } from "reroute";
|
|
|
|
import { serveSpa } from "serve_spa";
|
|
|
|
import { api } from "./api.ts";
|
|
|
|
|
|
|
|
export async function serveUi() {
|
|
|
|
const server = Deno.serve({ port: 5999 }, (request) =>
|
|
|
|
route(request, {
|
|
|
|
"/api/*": (request) => api.serve(request),
|
|
|
|
"/*": (request) =>
|
|
|
|
serveSpa(request, {
|
|
|
|
fsRoot: new URL("../ui/", import.meta.url).pathname,
|
|
|
|
indexFallback: true,
|
|
|
|
importMapFile: "../deno.json",
|
|
|
|
aliasMap: {
|
|
|
|
"/utils/*": "../utils/",
|
2023-09-26 10:43:36 +00:00
|
|
|
},
|
2023-10-05 09:00:51 +00:00
|
|
|
quiet: true,
|
|
|
|
}),
|
|
|
|
}));
|
2023-09-26 10:43:36 +00:00
|
|
|
|
|
|
|
await server.finished;
|
|
|
|
}
|