[Trunk|Service]: Add tinyUrl get method at /tiny?url=?

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-portal/trunk@56010 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
k.triantafyllou 2019-06-06 10:06:50 +00:00
parent ccf1419ab6
commit 00900b83cf
2 changed files with 13 additions and 1 deletions

View File

@ -15,6 +15,7 @@
"cors": "^2.8.4",
"express": "^4.17.1",
"multer": "^1.1.0",
"properties-reader": "0.0.16"
"properties-reader": "0.0.16",
"tinyurl": "^1.1.4"
}
}

View File

@ -4,6 +4,7 @@ var cookieParser = require('cookie-parser');
var multer = require("multer");
var PropertiesReader = require('properties-reader');
var properties = PropertiesReader('./properties.file');
var TinyURL = require('tinyurl');
var app = express();
var http = null;
@ -120,6 +121,16 @@ app.get('/download/:filename', function (req, res) {
res.download('./uploads/' + req.params.filename);
});
app.get('/tiny', function (req, res) {
TinyURL.shorten(req.query.url, function(res1, err) {
if (err)
console.log(err)
res.send({
tinyUrl: res1
});
});
});
app.delete('/delete/:filename', function (req, res) {
const token = req.headers['x-xsrf-token'];
if(!token) {