@@ -220,10 +220,47 @@ const swaggerOptions = {
220220} ;
221221
222222const swaggerSpec = swaggerJsdoc ( swaggerOptions ) ;
223- app . use ( '/api-docs' , swaggerUi . serve , swaggerUi . setup ( swaggerSpec , {
224- customCss : '.swagger-ui .topbar { display: none }' ,
225- customSiteTitle : 'EDMS API Documentation'
226- } ) ) ;
223+ // Serve swagger.json directly
224+ app . get ( '/api-docs/swagger.json' , ( req , res ) => {
225+ res . setHeader ( 'Content-Type' , 'application/json' ) ;
226+ res . send ( swaggerSpec ) ;
227+ } ) ;
228+
229+ // Simple API docs page
230+ app . get ( '/api-docs' , ( req , res ) => {
231+ res . send ( `
232+ <!DOCTYPE html>
233+ <html>
234+ <head>
235+ <title>EDMS API Documentation</title>
236+ <link rel="stylesheet" type="text/css" href="https://unpkg.com/[email protected] /swagger-ui.css" /> 237+ <style>
238+ body { margin: 0; padding: 20px; }
239+ .swagger-ui .topbar { display: none; }
240+ </style>
241+ </head>
242+ <body>
243+ <div id="swagger-ui"></div>
244+ <script src="https://unpkg.com/[email protected] /swagger-ui-bundle.js"></script> 245+ <script>
246+ SwaggerUIBundle({
247+ url: '/api-docs/swagger.json',
248+ dom_id: '#swagger-ui',
249+ deepLinking: true,
250+ presets: [
251+ SwaggerUIBundle.presets.apis,
252+ SwaggerUIBundle.presets.standalone
253+ ],
254+ plugins: [
255+ SwaggerUIBundle.plugins.DownloadUrl
256+ ],
257+ layout: "StandaloneLayout"
258+ });
259+ </script>
260+ </body>
261+ </html>
262+ ` ) ;
263+ } ) ;
227264
228265// Health check for API docs
229266app . get ( '/api-docs-health' , ( req , res ) => {
0 commit comments