Still trying to fix the /src/src/server.js issue for render.

This commit is contained in:
Rapturate
2026-04-28 00:29:23 -04:00
parent 0fde9f6c73
commit b4f568efab

View File

@@ -2,6 +2,8 @@ import express from 'express';
import morgan from 'morgan';
import fs from 'fs';
import path from 'path';
import { fileURLToPath } from 'url';
import swaggerUI from 'swagger-ui-express';
import yaml from 'js-yaml';
@@ -10,6 +12,9 @@ import ideasRoutes from './routes/ideasRoutes.js';
import projectsRoutes from './routes/projectsRoutes.js';
import materialsRoutes from './routes/materialsRoutes.js';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const app = express();
const PORT = process.env.PORT || 3000;
@@ -18,7 +23,8 @@ if (process.env.NODE_ENV !== 'test') app.use(morgan('tiny'));
let specs;
try {
specs = yaml.load(fs.readFileSync('./docs/openapi.yaml', 'utf8'));
const yamlPath = path.join(__dirname, '..', 'docs', 'openapi.yaml');
specs = yaml.load(fs.readFileSync(yamlPath, 'utf8'));
} catch (error) {
console.log('Failed to load OpenAPI specification', error);
process.exit(1);