File size: 1,718 Bytes
6f115e7
dc7aadc
cc43160
0e1d9b1
0521daa
 
 
6f115e7
b976227
0cdf085
 
6f115e7
3dd504b
2daf3bb
f13f46e
aaeefe8
1122fa5
 
35be412
daf6a5d
 
dc7aadc
90e4651
 
dc7aadc
aaeefe8
1122fa5
27ace8b
8babfe5
66a7c30
d312f25
a554442
d312f25
 
 
66a7c30
d312f25
0cdf085
 
 
 
 
 
 
 
 
 
 
 
 
6f9bb64
 
9280f36
 
 
 
 
 
6f9bb64
9280f36
6f9bb64
 
 
9280f36
d753ef3
17f2e27
4ebce36
d753ef3
 
17f2e27
 
 
 
 
6f318f5
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
72
73
74
75
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);