File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change 1
1
const express = require ( "express" ) ;
2
2
const bodyParser = require ( "body-parser" ) ;
3
3
const cors = require ( "cors" ) ;
4
- const path = require ( "path" ) ;
5
4
const swaggerUi = require ( "swagger-ui-express" ) ;
5
+ const path = require ( "path" ) ;
6
6
const openApiSpec = require ( "../swagger/openapi.json" ) ;
7
7
8
8
const app = express ( ) ;
@@ -20,10 +20,10 @@ app.use("/api/projects", projectRoutes);
20
20
app . use ( "/api/tasks" , taskRoutes ) ;
21
21
app . use ( "/api/users" , userRoutes ) ;
22
22
23
- // Swagger UI
23
+ // Serve Swagger UI
24
24
app . use ( "/api-docs" , swaggerUi . serve , swaggerUi . setup ( openApiSpec ) ) ;
25
25
26
- // OpenAPI JSON
26
+ // Serve the OpenAPI JSON
27
27
app . get ( "/openapi.json" , ( req , res ) => {
28
28
res . sendFile ( path . join ( __dirname , "../swagger/openapi.json" ) ) ;
29
29
} ) ;
You can’t perform that action at this time.
0 commit comments