fix: wildcard path for express 5

This commit is contained in:
2026-03-14 15:53:50 +00:00
parent 1d744df55e
commit 4be695886f
3 changed files with 17 additions and 1 deletions

7
.dockerignore Normal file
View File

@@ -0,0 +1,7 @@
node_modules
dist
.git
.agent
.antigravity
uploads
*.pdf

9
Dockerfile Normal file
View File

@@ -0,0 +1,9 @@
FROM node:20-slim
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
RUN npm run build:client
ENV PORT=3000
EXPOSE 3000
CMD ["npx", "tsx", "src/server/index.ts"]

View File

@@ -75,7 +75,7 @@ app.get('/health', (req, res) => {
const clientPath = path.join(process.cwd(), 'dist', 'client'); const clientPath = path.join(process.cwd(), 'dist', 'client');
if (fs.existsSync(clientPath)) { if (fs.existsSync(clientPath)) {
app.use(express.static(clientPath)); app.use(express.static(clientPath));
app.get('*', (req, res) => { app.get('/*', (req, res) => {
if (!req.path.startsWith('/api') && !req.path.startsWith('/uploads')) { if (!req.path.startsWith('/api') && !req.path.startsWith('/uploads')) {
res.sendFile(path.join(clientPath, 'index.html')); res.sendFile(path.join(clientPath, 'index.html'));
} }