File size: 1,761 Bytes
6f115e7 dc7aadc cc43160 1c2f245 83075c1 78a8417 3dd504b 0a020de e805e95 aaeefe8 7a35395 1122fa5 7a35395 daf6a5d dc7aadc 90e4651 dc7aadc aaeefe8 1122fa5 27ace8b 8babfe5 66a7c30 d312f25 a554442 d312f25 66a7c30 d312f25 0cdf085 754fbd2 0cdf085 6f9bb64 754fbd2 9280f36 6f9bb64 9280f36 6f9bb64 9280f36 d753ef3 17f2e27 4ebce36 754fbd2 d753ef3 17f2e27 1c2f245 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
import express from 'express';
const app = express()
import * as swaggerUi from 'swagger-ui-express';
import * as swaggerDocs from './swagger.js';
import * as cheerio from 'cheerio';
import * as lifestyle from './lifestyle.js';
import { OpenaiRes, tebakgambar, AnimeHentai } from './scrapper.js';
import { CheckMilWare } from './midware.js';
import exampleRoutes from './routes/example.js';
const CheckMilWares = new CheckMilWare();
app.use('/api', exampleRoutes);
app.use('/docs', swaggerUi.serve, swaggerUi.setup(swaggerDocs));
app.get('/', (req, res) => {
res.redirect('https://t.me/RendyProjects');
});
app.use(async (req, res, next) => {
await CheckMilWares.handle(req, res, next);
});
app.get('/api/test', async (req, res) => {
try {
res.send("Hello world")
} catch (error) {
res.status(401).json({error: error.message})
}
})
app.get('/api/hentai-anime', async (req, res) => {
try {
const result = await scrapper.AnimeHentai();
if (result) {
res.json({ result });
} else {
res.status(404).json({ error: "No result found." });
}
} catch (error) {
res.status(500).json({ error: error.message });
}
});
app.get('/api/tebakgambar', async (req, res) => {
try {
const result = await scrapper.tebakgambar();
if (result) {
res.json({ result });
} else {
res.status(404).json({ error: "No result found." });
}
} catch (error) {
res.status(500).json({ error: error.message });
}
});
app.get('/api/gpt-old', async (req, res) => {
try {
const query = req.query.query;
const results = await scrapper.OpenaiRes(query);
res.json({ results });
} catch (error) {
res.status(401).json({ error: error.message });
}
});
lifestyle.startServer(app); |