fix: wildcard path for express 5
This commit is contained in:
7
.dockerignore
Normal file
7
.dockerignore
Normal file
@@ -0,0 +1,7 @@
|
||||
node_modules
|
||||
dist
|
||||
.git
|
||||
.agent
|
||||
.antigravity
|
||||
uploads
|
||||
*.pdf
|
||||
9
Dockerfile
Normal file
9
Dockerfile
Normal 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"]
|
||||
@@ -75,7 +75,7 @@ app.get('/health', (req, res) => {
|
||||
const clientPath = path.join(process.cwd(), 'dist', 'client');
|
||||
if (fs.existsSync(clientPath)) {
|
||||
app.use(express.static(clientPath));
|
||||
app.get('*', (req, res) => {
|
||||
app.get('/*', (req, res) => {
|
||||
if (!req.path.startsWith('/api') && !req.path.startsWith('/uploads')) {
|
||||
res.sendFile(path.join(clientPath, 'index.html'));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user