File size: 858 Bytes
dc7aadc
 
cc43160
b74f76a
74442d8
3dd504b
2daf3bb
f13f46e
aaeefe8
1122fa5
 
dc7aadc
90e4651
 
dc7aadc
aaeefe8
1122fa5
27ace8b
8babfe5
66a7c30
d312f25
a554442
d312f25
 
 
66a7c30
d312f25
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
const express = require('express')
const app = express()

const {startServer} = require('./lifestyle');
const {OpenaiRes} = require('./scrapper');

var Database = require('./database.js');
var CheckMilWare = require('./midware.js');

const CheckMilWares = new CheckMilWare();

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/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);