Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
- Restructured app with backend/ and public/ directories - Created Express backend with /api/search endpoint - Added health check endpoint at /api/health - Optimized Dockerfile with multi-stage build - Added docker-compose.yml for easy deployment - Updated README with comprehensive documentation - Added .dockerignore for optimized builds - Backend listens on 0.0.0.0 for Docker compatibility
29 lines
892 B
JavaScript
29 lines
892 B
JavaScript
const express = require('express');
|
|
const path = require('path');
|
|
const app = express();
|
|
const families = require('./data/families.json');
|
|
|
|
// Serve static files from the public directory
|
|
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 Server running at http://localhost:${port}`);
|
|
console.log(`📍 API endpoint: http://localhost:${port}/api/search`);
|
|
});
|