Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

663 B
Raw Blame
/**
 * Search Routes
 *
 * GET /api/search?q=<query>
 *   Fan-out keyword search across all PortOS data sources.
 *   Returns categorized results grouped by source.
 */

import { Router } from 'express';
import { asyncHandler } from '../lib/errorHandler.js';
import { validateRequest, searchQuerySchema } from '../lib/validation.js';
import { fanOutSearch } from '../services/search.js';

const router = Router();

// GET /api/search?q=<query>
router.get('/', asyncHandler(async (req, res) => {
  const { q } = validateRequest(searchQuerySchema, req.query);
  const sources = await fanOutSearch(q);
  res.json({ query: q, sources });
}));

export default router;