Switch from Oak to Hono

This commit is contained in:
Zef Hemel
2024-01-13 18:07:02 +01:00
parent bf1eb03129
commit 291280b709
9 changed files with 372 additions and 458 deletions
+4 -5
View File
@@ -1,13 +1,13 @@
import { DiskSpacePrimitives } from "../common/spaces/disk_space_primitives.ts";
import { AssetBundle } from "../plugos/asset_bundle/bundle.ts";
import { Application } from "../server/deps.ts";
import { sleep } from "$sb/lib/async.ts";
import { ServerSystem } from "../server/server_system.ts";
import { AssetBundlePlugSpacePrimitives } from "../common/spaces/asset_bundle_space_primitives.ts";
import { determineDatabaseBackend } from "../server/db_backend.ts";
import { EndpointHook } from "../plugos/hooks/endpoint.ts";
import { determineShellBackend } from "../server/shell_backend.ts";
import { Hono } from "../server/deps.ts";
export async function runPlug(
spacePath: string,
@@ -18,7 +18,7 @@ export async function runPlug(
httpHostname = "127.0.0.1",
) {
const serverController = new AbortController();
const app = new Application();
const app = new Hono();
const dbBackend = await determineDatabaseBackend(spacePath);
@@ -41,12 +41,11 @@ export async function runPlug(
app.use((context, next) => {
return endpointHook.handleRequest(serverSystem.system!, context, next);
});
app.listen({
Deno.serve({
hostname: httpHostname,
port: httpServerPort,
signal: serverController.signal,
});
}, app.fetch);
if (functionName) {
const [plugName, funcName] = functionName.split(".");