refactor(nx/client): set up proxy to client

This commit is contained in:
Elian Doran 2025-04-23 10:08:02 +03:00
parent 5308a089b8
commit 659ccd8561
No known key found for this signature in database
2 changed files with 5 additions and 3 deletions

View File

@ -1,2 +1,3 @@
TRILIUM_ENV=dev
TRILIUM_DATA_DIR=./apps/server/data
TRILIUM_DATA_DIR=./apps/server/data
TRILIUM_PUBLIC_SERVER=http://localhost:4200

View File

@ -19,9 +19,10 @@ const persistentCacheStatic = (root: string, options?: serveStatic.ServeStaticOp
async function register(app: express.Application) {
const srcRoot = path.join(path.dirname(fileURLToPath(import.meta.url)), "..");
if (isDev) {
const clientProxy = proxy(process.env.TRILIUM_PUBLIC_SERVER);
app.use(`/${assetPath}/app/doc_notes`, persistentCacheStatic(path.join(srcRoot, "public/app/doc_notes")));
app.use(`/${assetPath}/app`, proxy("localhost:4200"));
app.use(`/${assetPath}/app-dist`, proxy("localhost:4200"));
app.use(`/${assetPath}/app`, clientProxy);
app.use(`/${assetPath}/app-dist`, clientProxy);
app.use(`/${assetPath}/stylesheets`, persistentCacheStatic(path.join(srcRoot, "../../client/stylesheets")));
app.use(`/${assetPath}/libraries`, persistentCacheStatic(path.join(srcRoot, "../../client/libraries")));
} else {