Update index.js
Browse files
index.js
CHANGED
@@ -22,17 +22,19 @@ import express from 'express';
|
|
22 |
const app = express();
|
23 |
|
24 |
import * as swaggerUi from 'swagger-ui-express';
|
25 |
-
import * as openapiSpecification from './swagger.js';
|
26 |
import * as cheerio from 'cheerio';
|
27 |
import * as lifestyle from './lifestyle.js';
|
28 |
|
29 |
-
import sharp from "sharp";
|
30 |
-
import cors from 'cors';
|
31 |
import { Readable } from "stream";
|
32 |
-
import bodyParser from 'body-parser';
|
33 |
import { schellwithflux } from './fluxai.js';
|
34 |
import { OpenaiRes, tebakgambar, AnimeHentai } from './scrapper.js';
|
35 |
import { CheckMilWare } from './midware.js';
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
|
37 |
// routes
|
38 |
import { GeminiRoutes } from './routes/googleGemini.js';
|
@@ -87,16 +89,30 @@ const swaggerOptions = {
|
|
87 |
|
88 |
const specs = swaggerJsDoc(swaggerOptions);
|
89 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
90 |
|
91 |
app.get('/', (req, res) => {
|
92 |
res.redirect('https://t.me/RendyProjects');
|
93 |
});
|
94 |
|
95 |
-
app.get('/api-docs.json', (req, res) => {
|
96 |
-
res.setHeader('Content-Type', 'application/json');
|
97 |
-
res.send(openapiSpecification);
|
98 |
-
});
|
99 |
-
|
100 |
app.use(async (req, res, next) => {
|
101 |
await CheckMilWares.handle(req, res, next);
|
102 |
});
|
|
|
22 |
const app = express();
|
23 |
|
24 |
import * as swaggerUi from 'swagger-ui-express';
|
|
|
25 |
import * as cheerio from 'cheerio';
|
26 |
import * as lifestyle from './lifestyle.js';
|
27 |
|
|
|
|
|
28 |
import { Readable } from "stream";
|
|
|
29 |
import { schellwithflux } from './fluxai.js';
|
30 |
import { OpenaiRes, tebakgambar, AnimeHentai } from './scrapper.js';
|
31 |
import { CheckMilWare } from './midware.js';
|
32 |
+
import { setup, serve } from './swagger.js';
|
33 |
+
|
34 |
+
import sharp from "sharp";
|
35 |
+
import cors from 'cors';
|
36 |
+
import bodyParser from 'body-parser';
|
37 |
+
import swaggerJsDoc from 'swagger-jsdoc';
|
38 |
|
39 |
// routes
|
40 |
import { GeminiRoutes } from './routes/googleGemini.js';
|
|
|
89 |
|
90 |
const specs = swaggerJsDoc(swaggerOptions);
|
91 |
|
92 |
+
app.use(
|
93 |
+
'/docs',
|
94 |
+
serve,
|
95 |
+
setup(specs, {
|
96 |
+
customCss: `
|
97 |
+
.swagger-ui .topbar { display: none; }
|
98 |
+
.swagger-ui .opblock .opblock-summary-path {
|
99 |
+
display: inline-block;
|
100 |
+
word-break: break-word;
|
101 |
+
white-space: nowrap;
|
102 |
+
overflow: hidden;
|
103 |
+
text-overflow: ellipsis;
|
104 |
+
max-width: 100%;
|
105 |
+
}
|
106 |
+
`,
|
107 |
+
customCssUrl: "https://cdnjs.cloudflare.com/ajax/libs/swagger-ui/4.3.0/swagger-ui.min.css",
|
108 |
+
customSiteTitle: 'AkenoXJs'
|
109 |
+
})
|
110 |
+
);
|
111 |
|
112 |
app.get('/', (req, res) => {
|
113 |
res.redirect('https://t.me/RendyProjects');
|
114 |
});
|
115 |
|
|
|
|
|
|
|
|
|
|
|
116 |
app.use(async (req, res, next) => {
|
117 |
await CheckMilWares.handle(req, res, next);
|
118 |
});
|