ryu-js / plugins /unblockip.js
randydev's picture
Create unblockip.js
7cb4551 verified
raw
history blame
636 Bytes
import express from 'express';
import { Database } from '../database/database.js';
const UnblockIpRoutes = express.Router();
UnblockIpRoutes.get('/api/v1/unblock-ip', async (req, res) => {
const dbClient = new Database("AkenoXJs", "FastJsAPI");
try {
const ip = req.query.ip;
results = await dbClient.UnblockedIp(ip);
if (results) {
res.json({ message: "successfully ip unbanned"});
} else {
res.status(404).json({ error: "No result found." });
}
} catch (error) {
res.status(500).json({ error: error.message });
}
});
export { UnblockIpRoutes };