aboutsummaryrefslogtreecommitdiff
path: root/vnext/server/middleware/urlexpand.js
blob: 730e2e8fa57da69594600e9dba784f9fdb086522 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
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);
    });
}