Skip to content

Commit

Permalink
refactor(deps): removed another obsolete lib and replaced it
Browse files Browse the repository at this point in the history
  • Loading branch information
brecke committed Apr 29, 2019
1 parent 860661f commit 99112b2
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions packages/oae-preview-processor/lib/rest.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*/

import _ from 'underscore';
import urlExpander from 'expand-url';
import { tall } from 'tall';

import * as OAE from 'oae-util/lib/oae';

Expand Down Expand Up @@ -118,16 +118,16 @@ OAE.tenantRouter.on('post', '/api/content/:contentId/revision/:revisionId/reproc
* @HttpResponse 200 The long URL
* @HttpResponse 500 The URL could not be expanded
*/
OAE.tenantRouter.on('get', '/api/longurl/expand', (req, res) => {
OAE.tenantRouter.on('get', '/api/longurl/expand', async (req, res) => {
const url = decodeURIComponent(req.query.url);
urlExpander.expand(url, (err, longUrl) => {
if (err) {
return res.status(500).send(err.message);
}

try {
const unshortenedUrl = await tall(url);
const data = {
'long-url': longUrl
'long-url': unshortenedUrl
};
return res.status(200).send(data);
});
} catch (err) {
return res.status(500).send(err.message);
}
});

0 comments on commit 99112b2

Please sign in to comment.