DisposableGuard

Express.js

const express = require('express');
const app = express();
app.use(express.json());

async function isDisposable(email) {
  try {
    const r = await fetch(
      `https://api.disposableguard.com/v1/check?email=${encodeURIComponent(email)}`,
      { headers: { Authorization: `Bearer ${process.env.DG_KEY}` } }
    );
    if (!r.ok) return false;
    const data = await r.json();
    return data.is_disposable === true;
  } catch {
    return false;
  }
}

app.post('/signup', async (req, res) => {
  if (await isDisposable(req.body.email)) {
    return res.status(400).json({ error: 'Please use a real email address.' });
  }
  // ...signup logic
  res.json({ ok: true });
});

Notes

Requires Node 18+ for native fetch, or use node-fetch for older versions.