Skip to content

Instantly share code, notes, and snippets.

@web-services-pro
web-services-pro / reddit-discovery.js
Created May 19, 2026 21:11
Reddit API client - Web Services Pro market research tool
// api/reddit-discovery.js
import OpenAI from "openai";
import { authenticateRequest, rateLimitByUser } from '../lib/middleware/auth.js';
import { validateAndSanitize } from '../lib/utils/validation.js';
import { cache } from '../lib/utils/cache.js';
import { createSuccessResponse, createErrorResponse } from '../lib/utils/response.js';
const ALLOWED_ORIGINS = process.env.ALLOWED_ORIGINS
? process.env.ALLOWED_ORIGINS.split(',')
: ['http://localhost:3000', 'https://digital-product-finder.vercel.app/'];