aboutsummaryrefslogtreecommitdiff
path: root/vnext/server/middleware/urlexpand.js
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2022-10-29 23:35:20 +0300
committerGravatar Vitaly Takmazov2023-01-13 10:37:58 +0300
commit47218df561e877265c739ffab59b760318ea3143 (patch)
tree166dd029133aca8d0d60af50535bb579bd6b8096 /vnext/server/middleware/urlexpand.js
parent3a403e4023ce3b7074a7922e7b504263ddc7a3d1 (diff)
Merge server routes from Next version
Diffstat (limited to 'vnext/server/middleware/urlexpand.js')
-rw-r--r--vnext/server/middleware/urlexpand.js14
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);
+ });
+}