Update index.js
Browse files
index.js
CHANGED
@@ -24,13 +24,13 @@ const app = express();
|
|
24 |
import * as swaggerUi from 'swagger-ui-express';
|
25 |
import * as cheerio from 'cheerio';
|
26 |
import * as lifestyle from './startup/lifestyle.js';
|
27 |
-
import {
|
28 |
import { Readable } from "stream";
|
|
|
29 |
import {
|
30 |
CheckMilWare,
|
31 |
authenticateApiKey,
|
32 |
-
apiLimiter
|
33 |
-
myUUID
|
34 |
} from './middleware/midware.js';
|
35 |
|
36 |
import { setup, serve } from './swagger.js';
|
@@ -54,6 +54,7 @@ import { GeminiRoutes } from './routes/googleGemini.js';
|
|
54 |
|
55 |
const __dirname = path.resolve();
|
56 |
const CheckMilWares = new CheckMilWare();
|
|
|
57 |
|
58 |
app.disable("x-powered-by");
|
59 |
app.disable("link")
|
@@ -73,6 +74,8 @@ app.use(
|
|
73 |
app.use(express.static('public'));
|
74 |
|
75 |
app.post('/generate-key', async (req, res) => {
|
|
|
|
|
76 |
try {
|
77 |
const newKey = myUUID;
|
78 |
await db('apiKeys').insertOne({
|
|
|
24 |
import * as swaggerUi from 'swagger-ui-express';
|
25 |
import * as cheerio from 'cheerio';
|
26 |
import * as lifestyle from './startup/lifestyle.js';
|
27 |
+
import { Database } from './database/database.js'
|
28 |
import { Readable } from "stream";
|
29 |
+
import * as uuid from 'uuid';
|
30 |
import {
|
31 |
CheckMilWare,
|
32 |
authenticateApiKey,
|
33 |
+
apiLimiter
|
|
|
34 |
} from './middleware/midware.js';
|
35 |
|
36 |
import { setup, serve } from './swagger.js';
|
|
|
54 |
|
55 |
const __dirname = path.resolve();
|
56 |
const CheckMilWares = new CheckMilWare();
|
57 |
+
const myUUID = uuid.v4();
|
58 |
|
59 |
app.disable("x-powered-by");
|
60 |
app.disable("link")
|
|
|
74 |
app.use(express.static('public'));
|
75 |
|
76 |
app.post('/generate-key', async (req, res) => {
|
77 |
+
const dbClient = new Database("AkenoXJs", "FastJsAPI");
|
78 |
+
const db = dbClient.collection()
|
79 |
try {
|
80 |
const newKey = myUUID;
|
81 |
await db('apiKeys').insertOne({
|