Coded Geekery

BlogAboutContact
BlogAboutContact

Revue

export default async (req, res) => { const result = await fetch('https://www.getrevue.co/api/v2/subscribers', { method: 'GET', headers: { Authorization: `Token ${process.env.REVUE_API_KEY}` } }); const data = await result.json(); if (!result.ok) { return res.status(500).json({ error: 'Error retrieving subscribers' }); } res.setHeader( 'Cache-Control', 'public, s-maxage=1200, stale-while-revalidate=600' ); return res.status(200).json({ count: data.length }); };

Usage#

  • Create Revue Account

  • First, create a Revue account.

  • Find API Key

  • From the Integrations page, retrieve your API key at the bottom.

  • Add Environment Variables

  • To securely access the API, we need to include the secret with each request. We also do not want to commit secrets to git. Thus, we should use an environment variable. Learn how to add environment variables in Vercel.

    Coded Geekery

    © 2022 Roger Stringer. All rights reserved.

    TwitterGitHubInstagramgumroad

    Stuff

    HomeAbout MeContact Me

    Not Playing

    Spotify

    Buy me a coffee

    Buy me a coffee