import express from 'express'; const app = express() import startServer from './lifestyle'; import swaggerUi from 'swagger-ui-express'; import swaggerDocs from './swagger'; import exampleRoutes from './akenox/routes/example'; import { OpenaiRes, tebakgambar, AnimeHentai } = from './scrapper'; var Database = require('./database.js'); var CheckMilWare = require('./midware.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 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 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 OpenaiRes(query); res.json({ results }); } catch (error) { res.status(401).json({ error: error.message }); } }); startServer(app);