-
Notifications
You must be signed in to change notification settings - Fork 4
/
main.tsx
57 lines (48 loc) · 1.58 KB
/
main.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import { main, suspend } from "effection";
import { createRevolution, route } from "revolution";
import { proxyRoute } from "./routes/proxy-route.ts";
import { assetsRoute } from "./routes/assets-route.ts";
import { pluginWorkshopRoute } from "./routes/advanced-backstage-plugin-development-route.tsx";
import { etagPlugin } from "./plugins/etag.ts";
import { currentRequestPlugin } from "./plugins/current-request.ts";
import { twindPlugin } from "./plugins/twind.ts";
import { config } from "./twind.config.ts";
await main(function* () {
let proxies = proxySites();
let revolution = createRevolution({
app: [
route(
"/workshops/advanced-backstage-plugin-development",
pluginWorkshopRoute(),
),
route("/effection(.*)", proxyRoute(proxies.effection)),
route("/graphgen(.*)", proxyRoute(proxies.graphgen)),
route("/assets(.*)", assetsRoute("assets")),
proxyRoute(proxies.legacy),
],
plugins: [
etagPlugin(),
currentRequestPlugin(),
twindPlugin({ config }),
],
});
let server = yield* revolution.start();
console.log(`www -> http://${server.hostname}:${server.port}`);
yield* suspend();
});
function proxySites() {
return {
effection: {
prefix: "effection",
website: Deno.env.get("EFFECTION_URL") ?? "https://effection.deno.dev",
},
graphgen: {
prefix: "graphgen",
website: Deno.env.get("GRAPHGEN_URL") ?? "https://graphgen.deno.dev",
},
legacy: {
prefix: "",
website: Deno.env.get("FS_LEGACY_URL") ?? "https://frontside.netlify.app",
},
} as const;
}