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