mirror of
https://github.com/openziti/zrok.git
synced 2025-06-23 19:22:19 +02:00
improved imports (#893)
This commit is contained in:
parent
0afed03c00
commit
8e1a6f08ab
2
sdk/nodejs1/.gitignore
vendored
Normal file
2
sdk/nodejs1/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
sdk/node_modules
|
||||||
|
dist
|
@ -1,7 +1,14 @@
|
|||||||
import {Command} from "commander";
|
import {Command} from "commander";
|
||||||
import {loadRoot} from "@openziti/zrok/dist/environment";
|
import {
|
||||||
import {express, init} from "@openziti/zrok/dist/express";
|
createShare,
|
||||||
import {createShare, deleteShare, PROXY_BACKEND_MODE, PUBLIC_SHARE_MODE, ShareRequest} from "@openziti/zrok/dist/share";
|
deleteShare,
|
||||||
|
express,
|
||||||
|
init,
|
||||||
|
loadRoot,
|
||||||
|
PROXY_BACKEND_MODE,
|
||||||
|
PUBLIC_SHARE_MODE,
|
||||||
|
ShareRequest
|
||||||
|
} from "@openziti/zrok";
|
||||||
|
|
||||||
const program = new Command();
|
const program = new Command();
|
||||||
|
|
||||||
@ -19,6 +26,7 @@ program
|
|||||||
let req = new ShareRequest(PUBLIC_SHARE_MODE, PROXY_BACKEND_MODE, "http-server");
|
let req = new ShareRequest(PUBLIC_SHARE_MODE, PROXY_BACKEND_MODE, "http-server");
|
||||||
req.frontends = ["public"];
|
req.frontends = ["public"];
|
||||||
let shr = await createShare(root, req);
|
let shr = await createShare(root, req);
|
||||||
|
|
||||||
let app = express(shr);
|
let app = express(shr);
|
||||||
app.get("/", (r: Request, res: any) => {
|
app.get("/", (r: Request, res: any) => {
|
||||||
res.write("hello, world!");
|
res.write("hello, world!");
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
import {Command} from "commander";
|
import {Command} from "commander";
|
||||||
import {loadRoot} from "@openziti/zrok/dist/environment";
|
import {createShare, deleteShare, loadRoot, PROXY_BACKEND_MODE, PUBLIC_SHARE_MODE, ShareRequest} from "@openziti/zrok";
|
||||||
import {createShare, deleteShare, PROXY_BACKEND_MODE, PUBLIC_SHARE_MODE, ShareRequest} from "@openziti/zrok/dist/share";
|
|
||||||
|
|
||||||
|
|
||||||
const program = new Command();
|
const program = new Command();
|
||||||
|
|
||||||
@ -22,7 +20,6 @@ program
|
|||||||
.catch(ex => {
|
.catch(ex => {
|
||||||
console.log("exception", ex);
|
console.log("exception", ex);
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
program.parse(process.argv);
|
program.parse(process.argv);
|
2
sdk/nodejs1/sdk/.gitignore
vendored
2
sdk/nodejs1/sdk/.gitignore
vendored
@ -1,2 +0,0 @@
|
|||||||
node_modules
|
|
||||||
dist
|
|
3
sdk/nodejs1/sdk/src/index.ts
Normal file
3
sdk/nodejs1/sdk/src/index.ts
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
export * from "./zrok/environment";
|
||||||
|
export * from "./zrok/express";
|
||||||
|
export * from "./zrok/share";
|
@ -1,6 +1,6 @@
|
|||||||
import {environmentFile, identityFile, metadataFile} from "./paths";
|
import {environmentFile, identityFile, metadataFile} from "./paths";
|
||||||
import * as fs from "node:fs";
|
import * as fs from "node:fs";
|
||||||
import {Configuration} from "./api";
|
import {Configuration} from "../api";
|
||||||
|
|
||||||
const ENVIRONMENT_V = "v0.4";
|
const ENVIRONMENT_V = "v0.4";
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
import {Share} from "./api";
|
import {Share} from "../api";
|
||||||
import Express from "express";
|
import Express from "express";
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import ziti from "@openziti/ziti-sdk-nodejs";
|
import ziti from "@openziti/ziti-sdk-nodejs";
|
@ -5,7 +5,7 @@ import {
|
|||||||
ShareRequestBackendModeEnum,
|
ShareRequestBackendModeEnum,
|
||||||
ShareRequestShareModeEnum,
|
ShareRequestShareModeEnum,
|
||||||
UnshareRequest
|
UnshareRequest
|
||||||
} from "./api";
|
} from "../api";
|
||||||
|
|
||||||
export type ShareMode = string;
|
export type ShareMode = string;
|
||||||
export const PRIVATE_SHARE_MODE: ShareMode = "private";
|
export const PRIVATE_SHARE_MODE: ShareMode = "private";
|
Loading…
x
Reference in New Issue
Block a user