This commit is contained in:
Zef Hemel
2022-10-24 13:51:26 +02:00
parent 2d9240ee25
commit 01aea4768b
11 changed files with 178 additions and 66 deletions
+26
View File
@@ -0,0 +1,26 @@
import { path } from "../server/deps.ts";
import { HttpServer } from "../server/http_server.ts";
import assetBundle from "../dist/asset_bundle.json" assert { type: "json" };
import { AssetBundle, AssetJson } from "../plugos/asset_bundle/bundle.ts";
export function serveCommand(options: any, folder: string) {
const pagesPath = path.resolve(Deno.cwd(), folder);
const port = options.port || 3000;
console.log(
"Going to start Silver Bullet on port",
port,
"serving pages from",
pagesPath,
);
const httpServer = new HttpServer({
port: port,
pagesPath: pagesPath,
assetBundle: new AssetBundle(assetBundle as AssetJson),
password: options.password,
});
httpServer.start().catch((e) => {
console.error(e);
});
}