Frontend changes

I still need to change the path of the excel in convert_to_JSON.js to be the updated data xlsx lmao
This commit is contained in:
Vadella, Anna
2026-03-26 12:35:58 -04:00
parent 24e0d2cc21
commit 3a912bf09e
8 changed files with 1938 additions and 71 deletions

View File

@@ -0,0 +1,14 @@
import movies from "../../../../movies.json"; // import JSON dataset containing all movies
export async function GET(req: Request) {
const {searchParams} = new URL(req.url); // gets request URL w/ query parameters
const query = searchParams.get("q")?.toLowerCase() || "";
const results = movies // only return movies that include search term in their title
.filter((m) => m.title.toLowerCase().includes(query)) // filter searches dataset for titles containing query
.slice(0, 10); // limit to top 10 results
return new Response(JSON.stringify(results), {
headers: {"Content-Type": "application/json"}, // returns JSON array of movie objects
});
}