Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
- Created backend/Dockerfile for Express API server - Created frontend/Dockerfile with Nginx for static files - Added nginx.conf to proxy /api/* to backend - Created docker-compose.microservices.yml for multi-container setup - Added .dockerignore files for both frontend and backend - Updated .woodpecker.yaml to fix registry URL and use separate Dockerfiles - Added CORS support to backend for microservices mode - Updated README with dual-mode deployment instructions - Frontend copies to frontend/public/ for Nginx serving - CI/CD pipeline now builds separate images for frontend and backend
36 lines
1.1 KiB
JavaScript
36 lines
1.1 KiB
JavaScript
const express = require('express');
|
|
const cors = require('cors');
|
|
const path = require('path');
|
|
const app = express();
|
|
const families = require('./data/families.json');
|
|
|
|
// Enable CORS for frontend
|
|
app.use(cors());
|
|
|
|
// Serve static files from the public directory (for standalone mode)
|
|
if (process.env.SERVE_STATIC === 'true') {
|
|
app.use(express.static(path.join(__dirname, '../public')));
|
|
}
|
|
|
|
// API endpoint for family search
|
|
app.get('/api/search', (req, res) => {
|
|
const query = req.query.family?.toLowerCase();
|
|
if (!query) {
|
|
return res.json([]);
|
|
}
|
|
const matches = families.filter(fam => fam.family.toLowerCase().includes(query));
|
|
res.json(matches);
|
|
});
|
|
|
|
// Health check endpoint
|
|
app.get('/api/health', (req, res) => {
|
|
res.json({ status: 'ok', timestamp: new Date().toISOString() });
|
|
});
|
|
|
|
const port = process.env.PORT || 3000;
|
|
app.listen(port, '0.0.0.0', () => {
|
|
console.log(`🗺️ Ora Map Backend API running at http://localhost:${port}`);
|
|
console.log(`📍 Search endpoint: http://localhost:${port}/api/search`);
|
|
console.log(`💚 Health endpoint: http://localhost:${port}/api/health`);
|
|
});
|