[object Object]

← back to AsSeenInMovies

snapshot: 1 file(s) changed, ~1 modified

0d70bcfbfeeb23bda7f8f0d6d168730a98661608 · 2026-05-13 08:57:46 -0700 · Steve

Files touched

Diff

commit 0d70bcfbfeeb23bda7f8f0d6d168730a98661608
Author: Steve <steve@designerwallcoverings.com>
Date:   Wed May 13 08:57:46 2026 -0700

    snapshot: 1 file(s) changed, ~1 modified
---
 server.js | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/server.js b/server.js
index 4acd1ad..ea487fb 100644
--- a/server.js
+++ b/server.js
@@ -95,6 +95,8 @@ app.get('/api', (_req, res) => {
       'GET /api/movies/random':  'A single random poster-having movie',
       'GET /api/people/random':  'A single random headshot-having person',
       'GET /api/credits/stats':  'Aggregate counts on asim_credits (total, acting, directing, writing, distinct_people, distinct_movies)',
+      'GET /api/movies/featured':'N random poster-having movies (?n=6, max 24) — multi-row companion to /api/movies/random',
+      'GET /api/people/featured':'N random headshot-having people (?n=6, max 24)',
       'GET /api/ingest/status':  'Background-ingest queue depth (admin-ish; safe to expose)',
     },
     public_data_only: true,
@@ -732,6 +734,25 @@ app.get('/api/spotted', async (req, res) => {
 // JSON stats — same numbers the /spotted gallery + /spotted/queue strips
 // render, exposed as a single small API. Useful for the status-loop tail
 // monitor and any external dashboard. No auth needed — public counts only.
+// /api/movies/featured + /api/people/featured — return N (default 6, max 24)
+// random poster/headshot-having rows. Used by widgets that want a small grid.
+app.get('/api/movies/featured', async (req, res) => {
+  try {
+    const n = Math.min(Math.max(parseInt(req.query.n, 10) || 6, 1), 24);
+    const r = await pool.query(`SELECT id, title, release_year, poster_url FROM asim_movies WHERE poster_url IS NOT NULL ORDER BY random() LIMIT ${n}`);
+    res.setHeader('Cache-Control', 'public, max-age=60, stale-while-revalidate=120');
+    res.json({ movies: r.rows });
+  } catch (e) { res.status(500).json({ error: e.message }); }
+});
+app.get('/api/people/featured', async (req, res) => {
+  try {
+    const n = Math.min(Math.max(parseInt(req.query.n, 10) || 6, 1), 24);
+    const r = await pool.query(`SELECT id, full_name, headshot_url, primary_profession FROM asim_people WHERE headshot_url IS NOT NULL ORDER BY random() LIMIT ${n}`);
+    res.setHeader('Cache-Control', 'public, max-age=60, stale-while-revalidate=120');
+    res.json({ people: r.rows });
+  } catch (e) { res.status(500).json({ error: e.message }); }
+});
+
 // /api/movies/random + /api/people/random — JSON companions to the /random/*
 // redirects. Lightweight, 60s cache. Used by widgets that want a row inline.
 app.get('/api/movies/random', async (_req, res) => {

← c6662ec asim sitemap.xml + .txt Cache-Control 1h→6h + SWR 24h (catal  ·  back to AsSeenInMovies  ·  asim Makefile — common dev targets (start, smoke, smoke-quie a1260ae →