[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:
parent
ccf1419ab6
commit
00900b83cf
|
@ -15,6 +15,7 @@
|
||||||
"cors": "^2.8.4",
|
"cors": "^2.8.4",
|
||||||
"express": "^4.17.1",
|
"express": "^4.17.1",
|
||||||
"multer": "^1.1.0",
|
"multer": "^1.1.0",
|
||||||
"properties-reader": "0.0.16"
|
"properties-reader": "0.0.16",
|
||||||
|
"tinyurl": "^1.1.4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ var cookieParser = require('cookie-parser');
|
||||||
var multer = require("multer");
|
var multer = require("multer");
|
||||||
var PropertiesReader = require('properties-reader');
|
var PropertiesReader = require('properties-reader');
|
||||||
var properties = PropertiesReader('./properties.file');
|
var properties = PropertiesReader('./properties.file');
|
||||||
|
var TinyURL = require('tinyurl');
|
||||||
var app = express();
|
var app = express();
|
||||||
var http = null;
|
var http = null;
|
||||||
|
|
||||||
|
@ -120,6 +121,16 @@ app.get('/download/:filename', function (req, res) {
|
||||||
res.download('./uploads/' + req.params.filename);
|
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) {
|
app.delete('/delete/:filename', function (req, res) {
|
||||||
const token = req.headers['x-xsrf-token'];
|
const token = req.headers['x-xsrf-token'];
|
||||||
if(!token) {
|
if(!token) {
|
||||||
|
|
Loading…
Reference in New Issue