Skip to content
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
Cannot retrieve contributors at this time
33 lines (27 sloc) 867 Bytes
import type { NextApiRequest, NextApiResponse } from 'next';
import Big from 'big.js';
const getProductSales = async (id) => {
const response = await fetch(`${id}`, {
headers: {
Authorization: `Bearer ${process.env.GUMROAD_API_KEY}`,
'Content-Type': 'application/json'
method: 'GET'
const { product } = await response.json();
return new Big(product.sales_usd_cents).div(100);
export default async function handler(
req: NextApiRequest,
res: NextApiResponse
) {
const masteringNextSales = await getProductSales('sDpG');
const react2025Sales = await getProductSales('TifxZ');
'public, s-maxage=1200, stale-while-revalidate=600'
return res.status(200).json({