Add delete tunnel endpoint

This commit is contained in:
Yaroslav Kukharuk
2020-10-29 15:47:10 +02:00
parent 78c06f8fc4
commit 97f88cee4c
+14
View File
@@ -50,6 +50,20 @@ export default function(opt) {
};
});
router.get('/api/tunnels/:id/delete', async (ctx, next) => {
const clientId = ctx.params.id;
const client = manager.getClient(clientId);
if (!client) {
ctx.throw(404);
return;
}
manager.removeClient(clientId);
ctx.body = {
delete_status: "success",
};
});
app.use(router.routes());
app.use(router.allowedMethods());