This commit is contained in:
Michael Quigley 2025-03-04 13:35:44 -05:00
parent 56b8d1e92c
commit 8ca598ab3a
No known key found for this signature in database
GPG Key ID: 9B60314A9DD20A62
2 changed files with 22 additions and 27 deletions

View File

@ -10,13 +10,7 @@ import {
ShareRequest ShareRequest
} from "@openziti/zrok"; } from "@openziti/zrok";
const program = new Command(); const httpServer = async () => {
program
.command("http-server")
.version("1.0.0")
.description("A simple HTTP server example, sharing directly to a zrok share")
.action(async () => {
let root = loadRoot(); let root = loadRoot();
await init(root) await init(root)
.catch((err: Error) => { .catch((err: Error) => {
@ -37,6 +31,8 @@ program
process.on("SIGINT", async () => { process.on("SIGINT", async () => {
deleteShare(root, shr); deleteShare(root, shr);
}); });
}); }
const program = new Command();
program.command("http-server").description("A simple HTTP server example, sharing directly to a zrok share").action(httpServer);
program.parse(process.argv); program.parse(process.argv);

View File

@ -13,8 +13,6 @@ import {
} from "@openziti/zrok"; } from "@openziti/zrok";
import readlineSync = require('readline-sync'); import readlineSync = require('readline-sync');
const program = new Command();
const copyto = async () => { const copyto = async () => {
let text = readlineSync.question("enter some text: "); let text = readlineSync.question("enter some text: ");
let root = loadRoot(); let root = loadRoot();
@ -36,5 +34,6 @@ const copyto = async () => {
}); });
} }
const program = new Command();
program.command("copyto").version("1.0.0").description("serve a copy buffer").action(copyto); program.command("copyto").version("1.0.0").description("serve a copy buffer").action(copyto);
program.parse(process.argv); program.parse(process.argv);