This commit is contained in:
parent
15eef31cc8
commit
7cc458fceb
44
index.js
44
index.js
|
@ -2,8 +2,8 @@
|
|||
|
||||
import express from 'express';
|
||||
import bodyParser from 'body-parser';
|
||||
import swaggerJSDoc from 'swagger-jsdoc';
|
||||
import swaggerUi from 'swagger-ui-express';
|
||||
// import swaggerJSDoc from 'swagger-jsdoc';
|
||||
// import swaggerUi from 'swagger-ui-express';
|
||||
import path from 'path';
|
||||
import { fileURLToPath } from 'url';
|
||||
import cookieParser from 'cookie-parser';
|
||||
|
@ -28,29 +28,29 @@ app.use(cookieParser()); // For parsing cookies
|
|||
app.use(express.static(path.join(__dirname, 'Front'))); // Serve static files from Pront directory
|
||||
|
||||
// Swagger setup
|
||||
const swaggerDefinition = {
|
||||
openapi: '3.0.0',
|
||||
info: {
|
||||
title: 'My API',
|
||||
version: '1.0.0',
|
||||
description: 'API documentation',
|
||||
},
|
||||
servers: [
|
||||
{
|
||||
url: serverURL,
|
||||
description: 'JJ server',
|
||||
},
|
||||
],
|
||||
};
|
||||
// const swaggerDefinition = {
|
||||
// openapi: '3.0.0',
|
||||
// info: {
|
||||
// title: 'My API',
|
||||
// version: '1.0.0',
|
||||
// description: 'API documentation',
|
||||
// },
|
||||
// servers: [
|
||||
// {
|
||||
// url: serverURL,
|
||||
// description: 'JJ server',
|
||||
// },
|
||||
// ],
|
||||
// };
|
||||
|
||||
const options = {
|
||||
swaggerDefinition,
|
||||
apis: ['./back/apps/app.js'],
|
||||
};
|
||||
// const options = {
|
||||
// swaggerDefinition,
|
||||
// apis: ['./back/apps/app.js'],
|
||||
// };
|
||||
|
||||
const swaggerSpec = swaggerJSDoc(options);
|
||||
// const swaggerSpec = swaggerJSDoc(options);
|
||||
|
||||
app.use('/api-docs', swaggerUi.serve, swaggerUi.setup(swaggerSpec));
|
||||
// app.use('/api-docs', swaggerUi.serve, swaggerUi.setup(swaggerSpec));
|
||||
|
||||
app.use((req, res, next) => {
|
||||
const host = req.headers.host;
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
"author": "Team.Stein",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"express": "^4.19.2",
|
||||
"swagger-jsdoc": "^6.2.8"
|
||||
"express": "^4.19.2"
|
||||
// "swagger-jsdoc": "^6.2.8"
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user