d
This commit is contained in:
parent
7b0eef8d1a
commit
6d9eeaad46
1 changed files with 25 additions and 0 deletions
25
index.js
25
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);
|
response.send(reply);
|
||||||
}
|
}
|
Loading…
Reference in a new issue