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