Add Docker Compose project scaffold
Sets up the full monorepo structure with: - Multi-stage Dockerfile (client-build + production stages) - docker-compose.yml for production, docker-compose.dev.yml overlay for development - Express server (port 3000) with pg pool, health route, and SPA static file serving - React 18 + Vite client with react-router-dom v6, nav bar, and placeholder page components - .env.example with PostgreSQL and app config - Empty db/migrations/ directory for future migrations - CLAUDE.md updated with development workflow commands Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
27
server/src/index.js
Normal file
27
server/src/index.js
Normal file
@@ -0,0 +1,27 @@
|
||||
require('dotenv').config();
|
||||
const express = require('express');
|
||||
const cors = require('cors');
|
||||
const path = require('path');
|
||||
const healthRouter = require('./routes/health');
|
||||
|
||||
const app = express();
|
||||
const PORT = process.env.PORT || 3000;
|
||||
|
||||
app.use(cors());
|
||||
app.use(express.json());
|
||||
|
||||
// API routes
|
||||
app.use('/api', healthRouter);
|
||||
|
||||
// Serve static client files in production
|
||||
const clientDist = path.join(__dirname, '../../client/dist');
|
||||
app.use(express.static(clientDist));
|
||||
|
||||
// SPA fallback — send index.html for any unmatched route
|
||||
app.get('*', (req, res) => {
|
||||
res.sendFile(path.join(clientDist, 'index.html'));
|
||||
});
|
||||
|
||||
app.listen(PORT, () => {
|
||||
console.log(`Server running on port ${PORT}`);
|
||||
});
|
||||
Reference in New Issue
Block a user