woodpecker soll nun auch das backend deployen
ci/woodpecker/push/woodpecker Pipeline failed

This commit is contained in:
2025-12-09 13:58:39 +01:00
parent e9a95ccf8d
commit c55e274718
6 changed files with 198 additions and 6 deletions
+11
View File
@@ -5,6 +5,9 @@ import multipart from '@fastify/multipart';
import cookie from '@fastify/cookie';
import { authenticate } from './middleware/auth.middleware.js';
import { env, validateEnv } from './config/env.js';
import { db, initDatabase } from './config/database.js';
import fastifyStatic from '@fastify/static';
import path from 'path';
// Import routes
import authRoute from './routes/auth.js';
@@ -57,6 +60,12 @@ fastify.register(multipart, {
},
});
// Serve static files (uploaded images, etc.)
fastify.register(fastifyStatic, {
root: path.join(process.cwd(), 'public'),
prefix: '/static/',
});
// Decorate fastify with authenticate method
fastify.decorate('authenticate', authenticate);
@@ -99,6 +108,8 @@ fastify.setErrorHandler((error, request, reply) => {
// Start server
const start = async () => {
try {
// Initialize database before starting server
initDatabase();
await fastify.listen({ port: env.PORT, host: '0.0.0.0' });
console.log(`🚀 Server listening on port ${env.PORT}`);
console.log(`📝 Environment: ${env.NODE_ENV}`);