-
-
Notifications
You must be signed in to change notification settings - Fork 30
Expand file tree
/
Copy pathsearch.json.ts
More file actions
24 lines (20 loc) · 687 Bytes
/
search.json.ts
File metadata and controls
24 lines (20 loc) · 687 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import type { APIRoute } from 'astro';
import { getAllEpisodes } from '../../../lib/rss';
export const prerender = true;
export const GET: APIRoute = async () => {
const allEpisodes = await getAllEpisodes();
// Return a simplified list of episodes optimized for search
const searchableEpisodes = allEpisodes.map((episode) => ({
id: episode.id,
title: episode.title,
description: episode.description,
episodeNumber: episode.episodeNumber,
episodeSlug: episode.episodeSlug,
episodeThumbnail: episode.episodeThumbnail
}));
return new Response(JSON.stringify(searchableEpisodes), {
headers: {
'Content-Type': 'application/json'
}
});
};