Khrisna commited on
Commit
8dd1a05
·
1 Parent(s): d5c31be

Update index.js

Browse files
Files changed (1) hide show
  1. index.js +20 -0
index.js CHANGED
@@ -90,6 +90,26 @@ app.post('/api/chatgpt2', async (req, res) => {
90
  res.json({ error: true, message: e === '[object Object]' ? 'Internal Server Error' : e })
91
  }
92
  })
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
93
 
94
  const PORT = process.env.PORT || 7860
95
  app.listen(PORT, () => console.log('App running on port', PORT))
 
90
  res.json({ error: true, message: e === '[object Object]' ? 'Internal Server Error' : e })
91
  }
92
  })
93
+ app.post('/api/toanime', async (req, res) => {
94
+ try {
95
+ console.log(req.body)
96
+ const { url status } = req.body
97
+ if (!url) return res.json({ success: false, message: 'Required an data text!' })
98
+ if (!status) return res.json({ success: false, message: 'Required an prompt text!' })
99
+
100
+ if(status !== apikey) return res.json({ success: false, message: 'Invalid status!' })
101
+ const response = await axios.request({
102
+ method: "GET",
103
+ url: `https://aemt.me/toanime?url=${url}`
104
+ })
105
+ const image = await axios.get(response.data.url.img_crop_single, responseType: "arraybuffer")
106
+ res.send(image.data)
107
+ } catch (e) {
108
+ console.log(e)
109
+ e = String(e)
110
+ res.json({ error: true, message: e === '[object Object]' ? 'Internal Server Error' : e })
111
+ }
112
+ })
113
 
114
  const PORT = process.env.PORT || 7860
115
  app.listen(PORT, () => console.log('App running on port', PORT))