umami/pages/api/share/[id].js

19 lines
386 B
JavaScript
Raw Normal View History

2020-08-15 10:17:15 +02:00
import { getWebsiteByShareId } from 'lib/queries';
import { ok, notFound, methodNotAllowed } from 'lib/response';
export default async (req, res) => {
const { id } = req.query;
if (req.method === 'GET') {
const website = await getWebsiteByShareId(id);
if (website) {
return ok(res, website);
}
return notFound(res);
}
return methodNotAllowed(res);
};