From 6d9eeaad465319dbe4c0bf011ff4261019edd8ed Mon Sep 17 00:00:00 2001 From: Killer Boss Original <73131550+killerbossoriginal@users.noreply.github.com> Date: Tue, 5 Jul 2022 15:20:23 +0200 Subject: [PATCH] d --- index.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/index.js b/index.js index 3b49af0..09b3742 100644 --- a/index.js +++ b/index.js @@ -93,5 +93,30 @@ async function set(request, response) { } } + response.send(reply); +} + +// Set a db variable + +app.get('/api/:auth/database/:element/remove', remove); + +async function remove(request, response) { + var token = request.params.auth; + var element = request.params.element; + var data = request.params.data; + + set = 'remove '+element + authenticate(token, set) + + await db.set(element, response, data) + const res = await db.delete(element) + if(res) { + var reply = res; + } else { + var reply = { + status:"Not Found" + } + } + response.send(reply); } \ No newline at end of file