Refactored locally

This commit is contained in:
krikorios
2025-06-08 22:26:43 +03:00
parent 8d26a47b46
commit 83ffdf860a
11 changed files with 89 additions and 43 deletions
+1
View File
@@ -1,3 +1,4 @@
import 'dotenv/config';
import express, { type Request, Response, NextFunction } from "express";
import { registerRoutes } from "./routes";
import { taskScheduler } from "./services/taskScheduler";
+5 -2
View File
@@ -1,11 +1,14 @@
import express, { type Express } from "express";
import fs from "fs";
import path from "path";
import { fileURLToPath } from 'node:url';
import { createServer as createViteServer, createLogger } from "vite";
import { type Server } from "http";
import viteConfig from "../vite.config";
import { nanoid } from "nanoid";
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const viteLogger = createLogger();
export function log(message: string, source = "express") {
@@ -46,7 +49,7 @@ export async function setupVite(app: Express, server: Server) {
try {
const clientTemplate = path.resolve(
import.meta.dirname,
__dirname,
"..",
"client",
"index.html",
@@ -68,7 +71,7 @@ export async function setupVite(app: Express, server: Server) {
}
export function serveStatic(app: Express) {
const distPath = path.resolve(import.meta.dirname, "public");
const distPath = path.resolve(__dirname, "public");
if (!fs.existsSync(distPath)) {
throw new Error(