Add delete tunnel endpoint
#151
@@ -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.routes());
|
||||||
app.use(router.allowedMethods());
|
app.use(router.allowedMethods());
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user