feature/enhanced-litters-and-pedigree #15

Merged
jason merged 4 commits from feature/enhanced-litters-and-pedigree into master 2026-03-09 02:07:38 -05:00
Showing only changes of commit 6f83f853ae - Show all commits

View File

@@ -4,7 +4,6 @@ const helmet = require('helmet');
const path = require('path');
const fs = require('fs');
const { initDatabase } = require('./db/init');
const { runMigrations } = require('./db/migrations');
const app = express();
const PORT = process.env.PORT || 3000;
@@ -21,20 +20,9 @@ if (!fs.existsSync(UPLOAD_PATH)) {
}
// Initialize database schema (creates tables if they don't exist)
console.log('Initializing database...');
initDatabase(DB_PATH);
// Run migrations to ensure schema is up-to-date
try {
console.log('Running database migrations...');
runMigrations(DB_PATH);
console.log('Database migrations complete!\n');
} catch (error) {
console.error('\n⚠ Database migration failed!');
console.error('Error:', error.message);
console.error('\nThe application may not function correctly.');
console.error('Please check the database and try again.\n');
// Don't exit - let the app try to start anyway
}
console.log('✓ Database ready!\n');
// Middleware
app.use(helmet({
@@ -81,13 +69,13 @@ app.use((err, req, res, next) => {
// Start server
app.listen(PORT, '0.0.0.0', () => {
console.log(`\n🐕 BREEDR Server Running`);
console.log(`=============================`);
console.log(`==============================`);
console.log(`Environment: ${process.env.NODE_ENV || 'development'}`);
console.log(`Port: ${PORT}`);
console.log(`Database: ${DB_PATH}`);
console.log(`Uploads: ${UPLOAD_PATH}`);
console.log(`Access: http://localhost:${PORT}`);
console.log(`=============================\n`);
console.log(`==============================\n`);
});
module.exports = app;