randydev commited on
Commit
7cb4551
·
verified ·
1 Parent(s): f8d227d

Create unblockip.js

Browse files
Files changed (1) hide show
  1. plugins/unblockip.js +20 -0
plugins/unblockip.js ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import express from 'express';
2
+ import { Database } from '../database/database.js';
3
+ const UnblockIpRoutes = express.Router();
4
+
5
+ UnblockIpRoutes.get('/api/v1/unblock-ip', async (req, res) => {
6
+ const dbClient = new Database("AkenoXJs", "FastJsAPI");
7
+ try {
8
+ const ip = req.query.ip;
9
+ results = await dbClient.UnblockedIp(ip);
10
+ if (results) {
11
+ res.json({ message: "successfully ip unbanned"});
12
+ } else {
13
+ res.status(404).json({ error: "No result found." });
14
+ }
15
+ } catch (error) {
16
+ res.status(500).json({ error: error.message });
17
+ }
18
+ });
19
+
20
+ export { UnblockIpRoutes };