AntiBot / index.js
XORE21's picture
Create index.js
40b569b verified
const express = require('express');
const cors = require('cors');
const antibot = require('./endpoints/antibot');
const app = express();
const port = process.env.PORT || 7860;
app.use(express.json({ limit: "50mb" }));
app.use(express.urlencoded({ extended: true, limit: "50mb" }));
app.use(cors());
app.get("/", (req, res) => {
res.json({
status: "active",
service: "Advanced AntiBot Solver",
engine: "Node.js + Sharp + Tesseract"
});
});
app.post("/antibot", async (req, res) => {
const data = req.body;
if (!data || !data.main || !Array.isArray(data.bots)) {
return res.status(400).json({
success: false,
message: "Invalid payload. 'main' (base64) and 'bots' (array of {id, img}) are required."
});
}
try {
const result = await antibot(data);
res.json(result);
} catch (err) {
console.error("Server Error: ", err);
res.status(500).json({ success: false, message: err.message });
}
});
app.listen(port, () => {
console.log(`⚡ Server running on port ${port}`);
});