aboutsummaryrefslogtreecommitdiff
path: root/vnext/server/middleware/urlexpand.js
blob: a99f80a7f3e1508e6e68978e174bd979ab19e365 (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)
    })
}