Added /minify/add

This commit is contained in:
Jyotirmoy Bandyopadhayaya 2022-02-01 13:25:25 +05:30 committed by GitHub
commit 38a532527a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 0 deletions

View File

@ -11,4 +11,16 @@ module.exports.getURLData = async (req, res) => {
console.error(err)
res.sendStatus(500)
}
}
module.exports.addURL = async (req, res) => {
req.body.minifiedUrl = base_url + req.body.alias
Minfy.create(req.body)
.then((data)=>{
res.send(data)
})
.catch((err)=>{
console.error(err)
res.sendStaus(500)
})
}

View File

@ -5,4 +5,6 @@ const router = Router();
router.get("/alias/:alias", controller.getURLData)
router.post("/add",controller.addURL)
module.exports = router;

3
package-lock.json generated Normal file
View File

@ -0,0 +1,3 @@
{
"lockfileVersion": 1
}