Migrated to NodeJS/Vite/Express/Material UI 2 #1

Merged
slawek merged 15 commits from feature/migration-to-nodejs into main 2026-04-20 08:04:33 +02:00
3 changed files with 11 additions and 11 deletions
Showing only changes of commit 4f97dc3362 - Show all commits

View File

@@ -2,12 +2,12 @@ FROM node:24-trixie-slim AS build
WORKDIR /app
COPY app-new/backend/package*.json backend/
COPY app-new/frontend/package*.json frontend/
COPY backend/package*.json backend/
COPY frontend/package*.json frontend/
RUN cd backend && npm ci
RUN cd frontend && npm ci
COPY app-new .
COPY . .
RUN cd backend && npm run build
RUN cd frontend && npm run build

View File

@@ -6,7 +6,7 @@ import { z } from "zod";
import { AzureImageService } from "./azure-service";
import { TemplateService } from "./template-service";
const findAppNewRoot = (): string => {
const findAppRoot = (): string => {
const candidates = [join(__dirname, "../../.."), join(__dirname, "../..")];
for (const candidate of candidates) {
@@ -15,7 +15,7 @@ const findAppNewRoot = (): string => {
}
}
throw new Error("Unable to resolve app-new root");
throw new Error("Unable to resolve app root");
};
const queryLocation = z.object({ location: z.string().min(1) });
@@ -143,7 +143,7 @@ const makeApp = () => {
res.status(500).json({ message });
});
const frontendRoot = join(findAppNewRoot(), "dist/frontend");
const frontendRoot = join(findAppRoot(), "dist/frontend");
if (existsSync(frontendRoot)) {
app.use(express.static(frontendRoot));
app.get(/^(?!\/api).*/, (_req, res) => {

View File

@@ -3,7 +3,7 @@ import { join } from "node:path";
import nunjucks from "nunjucks";
import type { ImageSelection, UsageTemplate } from "./types";
const findAppNewRoot = (): string => {
const findAppRoot = (): string => {
const candidates = [join(__dirname, "../../.."), join(__dirname, "../..")];
for (const candidate of candidates) {
@@ -12,19 +12,19 @@ const findAppNewRoot = (): string => {
}
}
throw new Error("Unable to resolve app-new template root");
throw new Error("Unable to resolve app template root");
};
export class TemplateService {
private readonly appNewRoot = findAppNewRoot();
private readonly appRoot = findAppRoot();
private readonly env = nunjucks.configure(join(this.appNewRoot, "templates"), {
private readonly env = nunjucks.configure(join(this.appRoot, "templates"), {
autoescape: false,
noCache: true
});
private readonly templates: UsageTemplate[] = JSON.parse(
readFileSync(join(this.appNewRoot, "templates.json"), "utf8")
readFileSync(join(this.appRoot, "templates.json"), "utf8")
) as UsageTemplate[];
public getTemplates(): UsageTemplate[] {