Refactored locally
This commit is contained in:
@@ -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
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user