XORE21 commited on
Commit
40b569b
·
verified ·
1 Parent(s): 41ae39b

Create index.js

Browse files
Files changed (1) hide show
  1. index.js +41 -0
index.js ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ const express = require('express');
2
+ const cors = require('cors');
3
+ const antibot = require('./endpoints/antibot');
4
+
5
+ const app = express();
6
+ const port = process.env.PORT || 7860;
7
+
8
+ app.use(express.json({ limit: "50mb" }));
9
+ app.use(express.urlencoded({ extended: true, limit: "50mb" }));
10
+ app.use(cors());
11
+
12
+ app.get("/", (req, res) => {
13
+ res.json({
14
+ status: "active",
15
+ service: "Advanced AntiBot Solver",
16
+ engine: "Node.js + Sharp + Tesseract"
17
+ });
18
+ });
19
+
20
+ app.post("/antibot", async (req, res) => {
21
+ const data = req.body;
22
+
23
+ if (!data || !data.main || !Array.isArray(data.bots)) {
24
+ return res.status(400).json({
25
+ success: false,
26
+ message: "Invalid payload. 'main' (base64) and 'bots' (array of {id, img}) are required."
27
+ });
28
+ }
29
+
30
+ try {
31
+ const result = await antibot(data);
32
+ res.json(result);
33
+ } catch (err) {
34
+ console.error("Server Error: ", err);
35
+ res.status(500).json({ success: false, message: err.message });
36
+ }
37
+ });
38
+
39
+ app.listen(port, () => {
40
+ console.log(`⚡ Server running on port ${port}`);
41
+ });