diff options
Diffstat (limited to 'vnext/server/middleware/urlexpand.js')
-rw-r--r-- | vnext/server/middleware/urlexpand.js | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/vnext/server/middleware/urlexpand.js b/vnext/server/middleware/urlexpand.js new file mode 100644 index 00000000..730e2e8f --- /dev/null +++ b/vnext/server/middleware/urlexpand.js @@ -0,0 +1,14 @@ +import { expandShortenedLink } from '../../src/api'; + +/** + * Expand URLs + * + * @param {import("next").NextApiRequest} req + * @param {import("next").NextApiResponse} res + */ +export default function urlExpand(req, res) { + let url = (req.query.url || '').toString(); + return expandShortenedLink(url).then(result => { + res.json(result); + }); +} |