wild card UI done

This commit is contained in:
2024-08-06 17:52:00 -04:00
parent 84db245f4a
commit 41919db8f8
6 changed files with 149 additions and 69 deletions
+22 -9
View File
@@ -29,7 +29,19 @@ router.post('/', async function(req, res, next){
}
});
router.get('/:item(*)', async function(req, res, next){
router.get('/lookup/:item', async function(req, res, next){
try{
return res.json({
string: req.params.item,
results: await Model.lookUp(req.params.item),
});
}catch(error){
return next(error);
}
});
router.get('/:item', async function(req, res, next){
try{
return res.json({
@@ -41,7 +53,7 @@ router.get('/:item(*)', async function(req, res, next){
}
});
router.put('/:item(*)', async function(req, res, next){
router.put('/:item', async function(req, res, next){
try{
req.body.updated_by = req.user.username;
let item = await Model.get(req.params.item);
@@ -59,7 +71,7 @@ router.put('/:item(*)', async function(req, res, next){
}
});
router.delete('/:item(*)', async function(req, res, next){
router.delete('/:item', async function(req, res, next){
try{
let item = await Model.get(req.params.item);
let count = await item.remove();
@@ -74,15 +86,16 @@ router.delete('/:item(*)', async function(req, res, next){
}
});
router.get('/lookup/:item(*)', async function(req, res, next){
router.put('/:item/renew', async function(req, res, next){
try{
return res.json({
string: req.params.item,
results: await Model.lookUp(req.params.item),
});
let item = await Model.get(req.params.item);
item.createWildcardCert();
return res.json({
message: `Requesting wildcard cert for ${req.params.item}`,
})
}catch(error){
return next(error);
next(error);
}
});