diff --git a/docker-compose.yaml b/docker-compose.yaml index 095b664..788a27a 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -12,7 +12,7 @@ services: - "traefik.http.routers.mb-grid-solutions.tls.certresolver=le" - "traefik.http.services.mb-grid-solutions.loadbalancer.server.port=3000" healthcheck: - test: ["CMD", "wget", "-q", "-O", "-", "http://localhost:3000/health"] + test: ["CMD", "node", "-e", "fetch('http://localhost:3000/health').then(r => r.ok ? process.exit(0) : process.exit(1)).catch(() => process.exit(1))"] interval: 5s timeout: 2s retries: 10 diff --git a/package.json b/package.json index 0775bdb..4d5276d 100644 --- a/package.json +++ b/package.json @@ -21,19 +21,12 @@ "license": "ISC", "description": "", "dependencies": { - "@vitejs/plugin-react-swc": "^3.11.0", "cors": "^2.8.5", "dotenv": "^17.2.3", "express": "^5.2.1", "express-rate-limit": "^8.2.1", - "framer-motion": "^12.26.2", "helmet": "^8.1.0", - "lucide-react": "^0.562.0", - "nodemailer": "^7.0.12", - "react": "^19.2.3", - "react-dom": "^19.2.3", - "react-router-dom": "^7.12.0", - "vite": "^6.4.1" + "nodemailer": "^7.0.12" }, "devDependencies": { "@types/cors": "^2.8.19", @@ -42,9 +35,16 @@ "@types/nodemailer": "^7.0.5", "@types/react": "^19.2.8", "@types/react-dom": "^19.2.3", + "@vitejs/plugin-react-swc": "^3.11.0", + "framer-motion": "^12.26.2", + "lucide-react": "^0.562.0", "nodemon": "^3.1.11", + "react": "^19.2.3", + "react-dom": "^19.2.3", + "react-router-dom": "^7.12.0", "ts-node": "^10.9.2", "typescript": "^5.9.3", + "vite": "^6.4.1", "vite-plugin-checker": "^0.12.0" } } diff --git a/server.ts b/server.ts index 08174d8..fc6270c 100644 --- a/server.ts +++ b/server.ts @@ -1,6 +1,5 @@ import express from 'express'; import path from 'path'; -import { fileURLToPath } from 'url'; import nodemailer from 'nodemailer'; import cors from 'cors'; import dotenv from 'dotenv'; @@ -9,9 +8,6 @@ import rateLimit from 'express-rate-limit'; dotenv.config(); -const __filename = fileURLToPath(import.meta.url); -const __dirname = path.dirname(__filename); - const app = express(); const PORT = process.env.PORT || 3000; @@ -97,12 +93,12 @@ app.get('/health', (req, res) => { }); // Serve static files from the React app -const distPath = path.join(__dirname, 'dist/frontend'); +const distPath = path.join(process.cwd(), 'dist/frontend'); app.use(express.static(distPath)); // The "catchall" handler: for any request that doesn't // match one above, send back React's index.html file. -app.get('*', (req, res) => { +app.get('(.*)', (req, res) => { res.sendFile(path.join(distPath, 'index.html')); });